mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00: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:
parent
4343cd2ceb
commit
331b30ebeb
1 changed files with 5 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue