Skip to content

BUG: NG2016 reported incorrectly for package libraries #48152

@kukjevov

Description

@kukjevov

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 using InjectionToken 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)

Node: 16.15.0
OS: Windows 10
Angular: 15

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2The issue is important to a large percentage of users, with a workaroundarea: compilerIssues related to `ngc`, Angular's template compilerstate: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions