fix(ivy): validate the NgModule declarations field (#34404)
This commit adds three previously missing validations to NgModule.declarations: 1. It checks that declared classes are actually within the current compilation. 2. It checks that declared classes are directives, components, or pipes. 3. It checks that classes are declared in at most one NgModule. PR Close #34404
This commit is contained in:

committed by
Kara Erickson

parent
9cabd6638e
commit
763f8d470a
@ -661,13 +661,16 @@ export class NgtscProgram implements api.Program {
|
||||
this.incrementalDriver.depGraph, this.closureCompilerEnabled),
|
||||
// TODO(alxhub): understand why the cast here is necessary (something to do with `null` not
|
||||
// being assignable to `unknown` when wrapped in `Readonly`).
|
||||
// clang-format off
|
||||
new DirectiveDecoratorHandler(
|
||||
this.reflector, evaluator, metaRegistry, this.defaultImportTracker, this.isCore,
|
||||
this.closureCompilerEnabled) as Readonly<DecoratorHandler<unknown, unknown, unknown>>,
|
||||
this.reflector, evaluator, metaRegistry, this.scopeRegistry, this.defaultImportTracker,
|
||||
this.isCore, this.closureCompilerEnabled) as Readonly<DecoratorHandler<unknown, unknown, unknown>>,
|
||||
// clang-format on
|
||||
// Pipe handler must be before injectable handler in list so pipe factories are printed
|
||||
// before injectable factories (so injectable factories can delegate to them)
|
||||
new PipeDecoratorHandler(
|
||||
this.reflector, evaluator, metaRegistry, this.defaultImportTracker, this.isCore),
|
||||
this.reflector, evaluator, metaRegistry, this.scopeRegistry, this.defaultImportTracker,
|
||||
this.isCore),
|
||||
new InjectableDecoratorHandler(
|
||||
this.reflector, this.defaultImportTracker, this.isCore,
|
||||
this.options.strictInjectionParameters || false),
|
||||
|
Reference in New Issue
Block a user