New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: NG2016 reported incorrectly for package libraries #48152
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
P2
The issue is important to a large percentage of users, with a workaround
state: has PR
Milestone
Comments
JoostK
added
area: compiler
Issues related to `ngc`, Angular's template compiler
P2
The issue is important to a large percentage of users, with a workaround
labels
Nov 21, 2022
JoostK
added a commit
to JoostK/angular
that referenced
this issue
Nov 21, 2022
…a library The stricter checks under `strictInjectionParameters` in Angular 15 now enforce that an inherited constructor must be compatible with DI, based on whether all parameters are valid injection tokens. There is an issue when the constructor is inherited from a class in a declaration file though, as information on the usage of `@Inject()` is not present within a declaration file. This means that this stricter check cannot be accurately performed, resulting in false positives. This commit disables the stricter check to behave the same as it did prior to Angular 15, therefore avoiding the false positive. Fixes angular#48152
Thanks for the report, this is indeed an oversight. |
kukjevov
changed the title
BUG: NG2016 reported incorrectly reported for package libraries
BUG: NG2016 reported incorrectly for package libraries
Nov 22, 2022
dylhunn
pushed a commit
that referenced
this issue
Nov 23, 2022
…a library (#48156) The stricter checks under `strictInjectionParameters` in Angular 15 now enforce that an inherited constructor must be compatible with DI, based on whether all parameters are valid injection tokens. There is an issue when the constructor is inherited from a class in a declaration file though, as information on the usage of `@Inject()` is not present within a declaration file. This means that this stricter check cannot be accurately performed, resulting in false positives. This commit disables the stricter check to behave the same as it did prior to Angular 15, therefore avoiding the false positive. Fixes #48152 PR Close #48156
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
trekladyone
pushed a commit
to trekladyone/angular
that referenced
this issue
Feb 1, 2023
…a library (angular#48156) The stricter checks under `strictInjectionParameters` in Angular 15 now enforce that an inherited constructor must be compatible with DI, based on whether all parameters are valid injection tokens. There is an issue when the constructor is inherited from a class in a declaration file though, as information on the usage of `@Inject()` is not present within a declaration file. This means that this stricter check cannot be accurately performed, resulting in false positives. This commit disables the stricter check to behave the same as it did prior to Angular 15, therefore avoiding the false positive. Fixes angular#48152 PR Close angular#48156
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
P2
The issue is important to a large percentage of users, with a workaround
state: has PR
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Event though declared as breaking change, it should not mean, that valid code should be also reported as bug.
The injectable SomeService inherits its constructor from RESTClient, but the latter has a constructor parameter that is not compatible with dependency injection. Either add an explicit constructor to SomeService or change RESTClient's constructor to use parameters that are valid for DI.
Base class has
@Injectable
and also is usingInjectionToken
for each constructor parameter that is not compatible with dependency injection.If i copy base class into project everything works fine, but if base class with parameters using
InjectionToken
is declared in package library and used as dependency, this error is reported.https://github.com/ressurectit/ng-rest/blob/13.0/src/rest/common.ts#L38
I can also provide full reproduction steps easily.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: