Files
main.tsmain
What you'll learn
- Recognise a circular dependency from the error it produces, at module level and at provider level
- Resolve a module cycle and a provider cycle with forwardRef(), on both sides
- Explain why, under native ES modules, the parameter's type must be a type-only import, and know the alternatives: ModuleRef and breaking the cycle
Press Run tests to start the app. Its log appears here.Graded endpoints
CatsService asked OwnersService, and both were built although each needs the other
The other direction: OwnersService asked CatsService
One cat
Across the cycle again
The rest of the service still works