Constructor parameter in service is not compatible with dependency injection after build
See original GitHub issueType of Issue
[ X] Bug Report
[ ] Feature Request
Description
A bug: please describe the error that you encountered
In Angular 15 / ng-pckagr 15, after building and installing my library into another project, a service provided in my library reports:
The injectable EnvironmentService inherits its constructor from NgxEnvironmentService, but the latter has a constructor parameter that is not compatible with dependency injection. Either add an explicit constructor to EnvironmentService or change NgxEnvironmentService's constructor to use parameters that are valid for DI.(-992016)
However, when using the same service in test code within the library, everything works as expected
A feature: please describe your use case and motivation
I do not want developers leveraging my library to have to provide constructor arguments when extending this service class if they are not doing additional work in the constructor.
How To Reproduce
This is a private, scoped package, but I am more than happy to provide all source code.
To reproduce the issue, I build the library and install it into another Angular application using a local file path in package.json
Expected Behaviour
In all prior versions of this library, from Angular 11 - 14, everything works as expected. Updating from Angular/ng-packagr 14 to 15 builds and tests fine, but fails when implemented in another app.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 15.0.1
@angular/*: 15.0.0
typescript: 4.8.2
rxjs: 7.5.7
node: 18.12.0
npm/yarn: 8.19.2
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 10 months ago
- Comments:17 (8 by maintainers)
Top GitHub Comments
If you’re curious: angular/angular#48156
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.