From 2de34770c4dd75ee2854326a239277102af6df21 Mon Sep 17 00:00:00 2001 From: Kara Erickson Date: Fri, 1 May 2020 16:43:01 -0700 Subject: [PATCH] docs: update deprecation guide to move deprecated APIs to removals (#36891) Previously, using undecorated base classes and using ModuleWithProviders without a generic were listed as deprecated features. In v10, these features will be removed and an error will be thrown instead. This commit updates the deprecation guide to reflect this change. PR Close #36891 --- aio/content/guide/deprecations.md | 80 ++-------------------- aio/content/guide/updating-to-version-9.md | 4 +- 2 files changed, 6 insertions(+), 78 deletions(-) diff --git a/aio/content/guide/deprecations.md b/aio/content/guide/deprecations.md index b4c0002d88..4a484da0fd 100644 --- a/aio/content/guide/deprecations.md +++ b/aio/content/guide/deprecations.md @@ -42,8 +42,6 @@ v9 - v12 | `@angular/core` | [`ReflectiveKey`](#core) | v11 | | `@angular/core` | [`RenderComponentType`](#core) | v11 | | `@angular/core` | [`ViewEncapsulation.Native`](#core) | v11 | -| `@angular/core` | [`ModuleWithProviders` without a generic](#moduleWithProviders) | v10 | -| `@angular/core` | [Undecorated base classes that use Angular features](#undecorated-base-classes) | v10 | | `@angular/forms` | [`ngModel` with reactive forms](#ngmodel-reactive) | v11 | | `@angular/router` | [`preserveQueryParams`](#router) | v11 | | `@angular/upgrade` | [`@angular/upgrade`](#upgrade) | v11 | @@ -97,8 +95,6 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i | [`defineInjectable`](api/core/defineInjectable) | `ɵɵdefineInjectable` | v8 | Used only in generated code. No source code should depend on this API. | | [`entryComponents`](api/core/NgModule#entryComponents) | none | v9 | See [`entryComponents`](#entryComponents) | | [`ANALYZE_FOR_ENTRY_COMPONENTS`](api/core/ANALYZE_FOR_ENTRY_COMPONENTS) | none | v9 | See [`ANALYZE_FOR_ENTRY_COMPONENTS`](#entryComponents) | -| `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | v9 | See [`ModuleWithProviders` section](#moduleWithProviders) | -| Undecorated base classes that use Angular features | Base classes with `@Directive()` decorator that use Angular features | v9 | See [undecorated base classes section](#undecorated-base-classes) | @@ -377,60 +373,6 @@ However, in practice, Angular simply ignores two-way bindings to template variab ``` -{@a undecorated-base-classes} -### Undecorated base classes using Angular features - -As of version 9, it's deprecated to have an undecorated base class that: - -- uses Angular features -- is extended by a directive or component - -Angular lifecycle hooks or any of the following Angular field decorators are considered Angular features: - -- `@Input()` -- `@Output()` -- `@HostBinding()` -- `@HostListener()` -- `@ViewChild()` / `@ViewChildren()` -- `@ContentChild()` / `@ContentChildren()` - -For example, the following case is deprecated because the base class uses `@Input()` and does not have a class-level decorator: - -```ts -class Base { - @Input() - foo: string; -} - -@Directive(...) -class Dir extends Base { - ngOnChanges(): void { - // notified when bindings to [foo] are updated - } -} -``` - -In a future version of Angular, this code will start to throw an error. -To fix this example, add a selectorless `@Directive()` decorator to the base class: - -```ts -@Directive() -class Base { - @Input() - foo: string; -} - -@Directive(...) -class Dir extends Base { - ngOnChanges(): void { - // notified when bindings to [foo] are updated - } -} -``` - -In version 9, the CLI has an automated migration that will update your code for you when `ng update` is run. -See [the dedicated migration guide](guide/migration-undecorated-classes) for more information about the change and more examples. - {@a binding-to-innertext} @@ -578,28 +520,14 @@ The final decision was made on three key points: {@a removed} ## Removed APIs -The following APIs have been removed starting with version 9.0.0*: +The following APIs have been removed starting with version 10.0.0*: | Package | API | Replacement | Notes | | ---------------- | -------------- | ----------- | ----- | -| `@angular/core` | [`Renderer`](https://v8.angular.io/api/core/Renderer) | [`Renderer2`](https://angular.io/api/core/Renderer2) | [Migration guide](guide/migration-renderer) | -| `@angular/core` | [`RootRenderer`](https://v8.angular.io/api/core/RootRenderer) | [`RendererFactory2`](https://angular.io/api/core/RendererFactory2) | none | -| `@angular/core` | [`RenderComponentType`](https://v8.angular.io/api/core/RenderComponentType) | [`RendererType2`](https://angular.io/api/core/RendererType2) | none | -| `@angular/core` | [`WtfScopeFn`](https://v8.angular.io/api/core/WtfScopeFn) | none | v8 | See [Web Tracing Framework](#wtf) | -| `@angular/core` | [`wtfCreateScope`](https://v8.angular.io/api/core/wtfCreateScope) | none | v8 | See [Web Tracing Framework](#wtf) | -| `@angular/core` | [`wtfStartTimeRange`](https://v8.angular.io/api/core/wtfStartTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) | -| `@angular/core` | [`wtfEndTimeRange`](https://v8.angular.io/api/core/wtfEndTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) | -| `@angular/core` | [`wtfLeave`](https://v8.angular.io/api/core/wtfLeave) | none | v8 | See [Web Tracing Framework](#wtf) | -| `@angular/common` | `DeprecatedI18NPipesModule` | [`CommonModule`](api/common/CommonModule#pipes) | none | -| `@angular/common` | `DeprecatedCurrencyPipe` | [`CurrencyPipe`](api/common/CurrencyPipe) | none | -| `@angular/common` | `DeprecatedDatePipe` | [`DatePipe`](api/common/DatePipe) | none | -| `@angular/common` | `DeprecatedDecimalPipe` | [`DecimalPipe`](api/common/DecimalPipe) | none | -| `@angular/common` | `DeprecatedPercentPipe` | [`PercentPipe`](api/common/PercentPipe) | none | -| `@angular/forms` | [`NgFormSelectorWarning`](https://v8.angular.io/api/forms/NgFormSelectorWarning) | none | none | -| `@angular/forms` | `ngForm` element selector | `ng-form` element selector | none | -| `@angular/service-worker` | `versionedFiles` | `files` | In the service worker configuration file `ngsw-config.json`, replace `versionedFiles` with `files`. See [Service Worker Configuration](guide/service-worker-config#assetgroups). | +| `@angular/core` | Undecorated base classes that use Angular features | Add Angular decorator | See [migration guide](guide/migration-undecorated-classes) for more info | +| `@angular/core` | `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | See [migration guide](guide/migration-module-with-providers) for more info | -*To see APIs removed in version 8, check out this guide on the [version 8 docs site](https://v8.angular.io/guide/deprecations#removed). +*To see APIs removed in version 9, check out this guide on the [version 9 docs site](https://v9.angular.io/guide/deprecations#removed). diff --git a/aio/content/guide/updating-to-version-9.md b/aio/content/guide/updating-to-version-9.md index e692bac84c..137b66976c 100644 --- a/aio/content/guide/updating-to-version-9.md +++ b/aio/content/guide/updating-to-version-9.md @@ -37,8 +37,8 @@ See our [template type-checking guide](guide/template-typecheck) for more inform | [`entryComponents`](api/core/NgModule#entryComponents) | none | See [`entryComponents`](guide/deprecations#entryComponents) | | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation)| `{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}` | From v11 the default code will be extracted from the locale data given by `LOCAL_ID`, rather than `USD`. | | [`ANALYZE_FOR_ENTRY_COMPONENTS`](api/core/ANALYZE_FOR_ENTRY_COMPONENTS) | none | See [`ANALYZE_FOR_ENTRY_COMPONENTS`](guide/deprecations#entryComponents) | -| `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | See [`ModuleWithProviders` section](guide/deprecations#moduleWithProviders) | -| Undecorated base classes that use Angular features | Base classes with `@Directive()` decorator that use Angular features | See [undecorated base classes section](guide/deprecations#undecorated-base-classes) | +| `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | | +| Undecorated base classes that use Angular features | Base classes with `@Directive()` decorator that use Angular features | | | `esm5` and `fesm5` distribution in `@angular/*` npm packages | `esm2015` and `fesm2015` entrypoints | See [`esm5` and `fesm5`](guide/deprecations#esm5-fesm5) | | [`TestBed.get`](api/core/testing/TestBed#get) | [`TestBed.inject`](api/core/testing/TestBed#inject) | Same behavior, but type safe. |