NestJS · Senior · Question 1 of 75

How does Nest know what to inject into constructor(private users: UsersService)?

Explanation

That's why type-only imports (import type) or interfaces break injection: there is no runtime value to use as a token.

Further reading

Problem with a question

NestJS · Senior · question 1

Test yourself

Take the NestJS · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz