-
Notifications
You must be signed in to change notification settings - Fork 43
demonstrate runtime error for @nebular/theme #526
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
The error is that the injector is not able to create I can see that ngcc is doing the right thing: NbScrollStrategyOptions.ngInjectableDef = ɵɵdefineInjectable({ factory: function NbScrollStrategyOptions_Factory() { return new NbScrollStrategyOptions(ɵɵinject(NbLayoutScrollService), ɵɵinject(ScrollDispatcher$1), ɵɵinject(NbViewportRulerAdapter), ɵɵinject(NgZone), ɵɵinject(NB_DOCUMENT)); }, token: NbScrollStrategyOptions, providedIn: "root" }); The problem is that The code is effectively: export function getInjectableDef<T>(type: any): ɵɵInjectableDef<T>|null {
const def = (type.ɵprov || type.ngInjectableDef) as ɵɵInjectableDef<T>;
return def && def.token === type ? def : null;
} Checking the But in this case it is wrong because, while |
Actually I just realised that ngcc should be using the "new" name (i.e.
|
Actually!! It turns out that this Therefore the fix really is only 1) from above. |
The `ngInjectableDef` property was renamed to `ɵprov`, but core must still support both because there are published libraries that use the older term. We are only interested in such properties that are defined directly on the type being injected, not on base classes. So there is a check that the defintion is specifically for the given type. Previously if you tried to inject a class that had `ngInjectableDef` but also inherited `ɵprov` then the check would fail on the `ɵprov` property and never even try the `ngInjectableDef` property resulting in a failed injection. This commit fixes this by attempting to find each of the properties independently. Fixes angular/ngcc-validation#526
…33732) The `ngInjectableDef` property was renamed to `ɵprov`, but core must still support both because there are published libraries that use the older term. We are only interested in such properties that are defined directly on the type being injected, not on base classes. So there is a check that the defintion is specifically for the given type. Previously if you tried to inject a class that had `ngInjectableDef` but also inherited `ɵprov` then the check would fail on the `ɵprov` property and never even try the `ngInjectableDef` property resulting in a failed injection. This commit fixes this by attempting to find each of the properties independently. Fixes angular/ngcc-validation#526 PR Close #33732
…33732) The `ngInjectableDef` property was renamed to `ɵprov`, but core must still support both because there are published libraries that use the older term. We are only interested in such properties that are defined directly on the type being injected, not on base classes. So there is a check that the defintion is specifically for the given type. Previously if you tried to inject a class that had `ngInjectableDef` but also inherited `ɵprov` then the check would fail on the `ɵprov` property and never even try the `ngInjectableDef` property resulting in a failed injection. This commit fixes this by attempting to find each of the properties independently. Fixes angular/ngcc-validation#526 PR Close #33732
Repro for #529