angular-cn/packages/core/schematics/migrations
Paul Gschwendtner c6ecdc9a81 feat(core): undecorated-classes-with-decorated-fields migration should handle classes with lifecycle hooks (#36921)
As of v10, undecorated classes using Angular features are no longer
supported. In v10, we plan on removing the undecorated classes
compatibility code in ngtsc. This means that old patterns for
undecorated classes will result in compilation errors.

We had a migration for this in v9 already, but it looks like
the migration does not handle cases where classes uses lifecycle
hooks. This is handled in the ngtsc compatibility code, and we
should handle it similarly in migrations too.

This has not been outlined in the migration plan initially,
but an appendix has been added for v10 to the plan document.

https://hackmd.io/vuQfavzfRG6KUCtU7oK_EA?both.

Note: The migration is unable to determine whether a given undecorated
class that only defines `ngOnDestroy` is a directive or an actual
service. This means that in some cases the migration cannot do
more than adding a TODO and printing an failure.

Certainly there are more ways to determine the type of such classes,
but it would involve metadata and NgModule analysis. This is out of
scope for this migration.

PR Close #36921
2020-05-06 15:06:10 -07:00
..
dynamic-queries fix(core): avoid migration error when non-existent symbol is imported (#36367) 2020-04-06 13:21:54 -07:00
google3 build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00
missing-injectable fix(core): missing-injectable migration should not migrate `@NgModule` classes (#36369) 2020-04-21 12:54:24 -04:00
module-with-providers build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00
move-document fix(core): avoid migration error when non-existent symbol is imported (#36367) 2020-04-06 13:21:54 -07:00
renderer-to-renderer2 build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00
static-queries build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00
template-var-assignment fix(core): avoid migration error when non-existent symbol is imported (#36367) 2020-04-06 13:21:54 -07:00
undecorated-classes-with-decorated-fields feat(core): undecorated-classes-with-decorated-fields migration should handle classes with lifecycle hooks (#36921) 2020-05-06 15:06:10 -07:00
undecorated-classes-with-di build: reformat repo to new clang@1.4.0 (#36613) 2020-04-14 12:08:36 -07:00