angular-cn/packages/core/schematics/test/google3
Paul Gschwendtner 32eafef6a7 fix(core): undecorated-classes-with-decorated-fields migration does not decorate derived classes (#35339)
The `undecorated-classes-with-decorated-fields` migration has been
introduced with 904a2018e0, but misses
logic for decorating derived classes of undecorated classes which use
Angular features. Example scenario:

```ts
export abstract class MyBaseClass {
  @Input() someInput = true;
}

export abstract class BaseClassTwo extends MyBaseClass {}

@Component(...)
export class MyButton extends BaseClassTwo {}
```

Both abstract classes would need to be migrated. Previously, the migration
only added `@Directive()` to `MyBaseClass`, but with this change, it
also decorates `BaseClassTwo`.

This is necessary because the Angular Compiler requires `BaseClassTwo` to
have a directive definition when it flattens the directive metadata for
`MyButton` in order to perform type checking. Technically, not decorating
`BaseClassTwo` does not break at runtime.

We basically want to enforce consistent use of `@Directive` to simplify the
mental model. [See the migration guide](https://angular.io/guide/migration-undecorated-classes#migrating-classes-that-use-field-decorators).

Fixes #34376.

PR Close #35339
2020-04-02 10:51:48 -07:00
..
BUILD.bazel test(core): cleanup bazel target names for schematic tests (#32318) 2019-08-28 17:11:04 -07:00
dynamic_queries_spec.ts build: update tslint to latest version (#35800) 2020-03-03 09:20:48 -08:00
explicit_query_timing_rule_spec.ts build: update tslint to latest version (#35800) 2020-03-03 09:20:48 -08:00
missing_injectable_rule_spec.ts build: update tslint to latest version (#35800) 2020-03-03 09:20:48 -08:00
no_template_variable_assignment_rule_spec.ts build: update tslint to latest version (#35800) 2020-03-03 09:20:48 -08:00
renderer_to_renderer2_spec.ts build: update tslint to latest version (#35800) 2020-03-03 09:20:48 -08:00
undecorated_classes_with_decorated_fields_spec.ts fix(core): undecorated-classes-with-decorated-fields migration does not decorate derived classes (#35339) 2020-04-02 10:51:48 -07:00