mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): support injection of object with null constructor. (#56553)
This is debug only code, it shouldn't have any consequences on prod build. fixes #56552 PR Close #56553
This commit is contained in:
committed by
Jessica Janiuk
parent
4343cd2ceb
commit
331b30ebeb
@@ -207,11 +207,13 @@ function handleInstanceCreatedByInjectorEvent(
|
||||
|
||||
// if our value is an instance of a standalone component, map the injector of that standalone
|
||||
// component to the component class. Otherwise, this event is a noop.
|
||||
let standaloneComponent: Type<unknown> | undefined = undefined;
|
||||
let standaloneComponent: Type<unknown> | undefined | null = undefined;
|
||||
if (typeof value === 'object') {
|
||||
standaloneComponent = value?.constructor as Type<unknown>;
|
||||
standaloneComponent = value?.constructor as Type<unknown> | undefined | null;
|
||||
}
|
||||
if (standaloneComponent === undefined || !isStandaloneComponent(standaloneComponent)) {
|
||||
|
||||
// We want to also cover if `standaloneComponent === null` in addition to `undefined`
|
||||
if (standaloneComponent == undefined || !isStandaloneComponent(standaloneComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user