[AoT] Partial type in service constructor not resolved
See original GitHub issueType of Issue
[ X ] Bug Report
[ ] Feature Request
Description
Inkection tokens for configuring some services should provide some values which will override default ones. That’s what Partial
type does - set each of class property as not required. Angular services works and builds well with this behavior, but libraries are not.
How To Reproduce
Here’s a project built using default commands with updated to Angular 7.2 dependencies and Partial
in library constructor. Clone it and run npm run build:lib
. The error you will get:
BUILD ERROR D:/Soft/OSPanel/node/angular/partial-error-setup/projects/test-lib/src/lib/test-lib.service.ts:10:1: Error encountered in metadata generated for exported symbol ‘TestLibService’: D:/Soft/OSPanel/node/angular/partial-error-setup/projects/test-lib/src/lib/test-lib.service.ts:16:33: Metadata collected contains an error that will be reported at runtime: Could not resolve type Partial. {“__symbolic”:“error”,“message”:“Could not resolve type”,“line”:15,“character”:32,“context”:{“typeName”:“Partial”}}
Expected Behaviour
Regular build without error.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 4.6.0
@angular/compiler: 7.2.0
rollup: 0.67.4
tsickle: 0.34.0
typescript: 3.2.2
node: 10.13.0
npm/yarn: 6.4.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top GitHub Comments
I’m facing this issue too.
I’m building out a library of components to be shared across multiple projects. In the past, these components were embedded in a particular project. But now, we want to share them via an npm package built through an angular cli library. The components take some optional overrides from outside.
I imagine this is a desirable use case. Is it intentionally not supported?
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases.