feat(core): undecorated-classes migration should handle derived abstract classes (#35339)
In version 10, undecorated base classes that use Angular features need to be decorated explicitly with `@Directive()`. Additionally, derived classes of abstract directives need to be decorated. The migration already handles this for undecorated classes that are not explicitly decorated, but since in V9, abstract directives can be used, we also need to handle this for explicitly decorated abstract directives. e.g. ``` @Directive() export class Base {...} // needs to be decorated by migration when updating from v9 to v10 export class Wrapped extends Base {} @Component(...) export class Cmp extends Wrapped {} ``` PR Close #35339
This commit is contained in:

committed by
Kara Erickson

parent
3d2db5c5f0
commit
c24ad560fa
@ -1,4 +1,12 @@
|
||||
import {Component, ElementRef, HostBinding, HostListener, Input, NgModule} from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Directive,
|
||||
ElementRef,
|
||||
HostBinding,
|
||||
HostListener,
|
||||
Input,
|
||||
NgModule
|
||||
} from '@angular/core';
|
||||
|
||||
export class NonAngularBaseClass {
|
||||
greet() {}
|
||||
@ -45,3 +53,10 @@ export class WrappedMyComp extends MyComp {}
|
||||
|
||||
@NgModule({declarations: [MyComp, WrappedMyComp]})
|
||||
export class TestModule {}
|
||||
|
||||
@Directive({selector: null})
|
||||
export class AbstractDir {}
|
||||
|
||||
export class DerivedAbstractDir extends AbstractDir {}
|
||||
|
||||
export class WrappedDerivedAbstractDir extends DerivedAbstractDir {}
|
||||
|
@ -1,4 +1,12 @@
|
||||
import { Component, ElementRef, HostBinding, HostListener, Input, NgModule, Directive } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Directive,
|
||||
ElementRef,
|
||||
HostBinding,
|
||||
HostListener,
|
||||
Input,
|
||||
NgModule
|
||||
} from '@angular/core';
|
||||
|
||||
export class NonAngularBaseClass {
|
||||
greet() {}
|
||||
@ -55,3 +63,12 @@ export class WrappedMyComp extends MyComp {}
|
||||
|
||||
@NgModule({declarations: [MyComp, WrappedMyComp]})
|
||||
export class TestModule {}
|
||||
|
||||
@Directive({selector: null})
|
||||
export class AbstractDir {}
|
||||
|
||||
@Directive()
|
||||
export class DerivedAbstractDir extends AbstractDir {}
|
||||
|
||||
@Directive()
|
||||
export class WrappedDerivedAbstractDir extends DerivedAbstractDir {}
|
||||
|
Reference in New Issue
Block a user