Support using @Inject()
decorator factory with no args on constructor-based injections
#13426
Closed
1 task done
Labels
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
If we use
@Inject()
onconstructor
, Nest will think that that is due to some circular (acting the same as@Inject(undefined)
, basically). While we should use@Inject()
on property-based injections.For example:
as of now, we'll see the following error:
Describe the solution you'd like
I think that it will be less confusing if we start supporting
@Inject()
on constructor-based injection as well. Those@Inject()
calls just need to be 'ignored', so people won't complain on why they're seen such error. Working the same as not having@Inject()
I managed to change the following code in order to support that:
nest/packages/common/decorators/core/inject.decorator.ts
Lines 36 to 40 in 6f119a7
to:
so now I'm seen this output instead of that error:
but I'm not sure if that's the right way to implement such feature
Teachability, documentation, adoption, migration strategy
N/A
What is the motivation / use case for changing the behavior?
The text was updated successfully, but these errors were encountered: