fix(ivy): verify bootstrapped types are Components (#28386)
Prior to this change we didn't verify types passed to bootstrap as a part of NgModule semantics verification. Now we check whether all types passed to bootstrap are actually Components. PR Close #28386
This commit is contained in:

committed by
Jason Aden

parent
495a9dd445
commit
7d9aa67d8c
@ -169,6 +169,7 @@ function verifySemanticsOfNgModuleDef(moduleType: NgModuleType): void {
|
||||
ngModule.imports &&
|
||||
flatten(ngModule.imports, unwrapModuleWithProvidersImports)
|
||||
.forEach(verifySemanticsOfNgModuleDef);
|
||||
ngModule.bootstrap && ngModule.bootstrap.forEach(verifyCorrectBootstrapType);
|
||||
ngModule.bootstrap && ngModule.bootstrap.forEach(verifyComponentIsPartOfNgModule);
|
||||
ngModule.entryComponents && ngModule.entryComponents.forEach(verifyComponentIsPartOfNgModule);
|
||||
}
|
||||
@ -226,6 +227,13 @@ function verifySemanticsOfNgModuleDef(moduleType: NgModuleType): void {
|
||||
}
|
||||
}
|
||||
|
||||
function verifyCorrectBootstrapType(type: Type<any>) {
|
||||
type = resolveForwardRef(type);
|
||||
if (!getComponentDef(type)) {
|
||||
errors.push(`${renderStringify(type)} cannot be used as an entry component.`);
|
||||
}
|
||||
}
|
||||
|
||||
function verifyComponentEntryComponentsIsPartOfNgModule(type: Type<any>) {
|
||||
type = resolveForwardRef(type);
|
||||
if (getComponentDef(type)) {
|
||||
|
Reference in New Issue
Block a user