feat(compiler-cli): report error if undecorated class with Angular features is discovered (#36921)
Previously in v9, we deprecated the pattern of undecorated base classes that rely on Angular features. We ran a migration for this in version 9 and will run the same on in version 10 again. To ensure that projects do not regress and start using the unsupported pattern again, we report an error in ngtsc if such undecorated classes are discovered. We keep the compatibility code enabled in ngcc so that libraries can be still be consumed, even if they have not been migrated yet. Resolves FW-2130. PR Close #36921
This commit is contained in:

committed by
Alex Rickabaugh

parent
c6ecdc9a81
commit
4c92cf43cf
@ -104,7 +104,13 @@ export class DecorationAnalyzer {
|
||||
new DirectiveDecoratorHandler(
|
||||
this.reflectionHost, this.evaluator, this.fullRegistry, this.scopeRegistry,
|
||||
this.fullMetaReader, NOOP_DEFAULT_IMPORT_RECORDER, this.injectableRegistry, this.isCore,
|
||||
/* annotateForClosureCompiler */ false) as DecoratorHandler<unknown, unknown, unknown>,
|
||||
/* annotateForClosureCompiler */ false,
|
||||
// In ngcc we want to compile undecorated classes with Angular features. As of
|
||||
// version 10, undecorated classes that use Angular features are no longer handled
|
||||
// in ngtsc, but we want to ensure compatibility in ngcc for outdated libraries that
|
||||
// have not migrated to explicit decorators. See: https://hackmd.io/@alx/ryfYYuvzH.
|
||||
/* compileUndecoratedClassesWithAngularFeatures */ true
|
||||
) as 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)
|
||||
|
Reference in New Issue
Block a user