From 81d09d14dc5c7bfb988d35daae88c9de2f23811e Mon Sep 17 00:00:00 2001 From: JoostK Date: Sat, 18 Sep 2021 21:41:15 +0200 Subject: [PATCH] docs: deprecate input setter coercion fields (#43506) Since the `strictTemplates` flag has been introduced in Angular the compiler has been able to type-check input bindings to the declared input type of the corresponding directive. When a getter/setter pair is being used for the input it may be desirable to let the setter accept a broader set of types than what is returned by the getter, for example when the setter first converts the input value. However, until TypeScript 4.3 a getter/setter pair was required to have identical types so this pattern could not be accurately declared. To mitigate this limitation, it was made possible to declare input setter coercion fields in directives that are used when type-checking input bindings. However, since TypeScript 4.3 the limitation has been removed; setters can now accept a wider type than what is returned by the getter. This means that input coercion fields are no longer needed, as their effects can be achieved by widening the type of the setter. PR Close #43506 --- aio/content/guide/aot-compiler.md | 2 +- aio/content/guide/deprecations.md | 50 +++++++++++++++++++++++++ aio/content/guide/template-typecheck.md | 10 ++++- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index 487be796dcc..bc430713151 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -618,7 +618,7 @@ For example, to avoid `Object is possibly 'undefined'` error in the template abo Using `*ngIf` allows the TypeScript compiler to infer that the `person` used in the binding expression will never be `undefined`. -For more information about input type narrowing, see [Input setter coercion](guide/template-typecheck#input-setter-coercion) and [Improving template type checking for custom directives](guide/structural-directives#directive-type-checks). +For more information about input type narrowing, see [Improving template type checking for custom directives](guide/structural-directives#directive-type-checks). ### Non-null type assertion operator diff --git a/aio/content/guide/deprecations.md b/aio/content/guide/deprecations.md index 9e908f05c31..f3a92f5357a 100644 --- a/aio/content/guide/deprecations.md +++ b/aio/content/guide/deprecations.md @@ -48,6 +48,7 @@ v12 - v15 | template syntax | [`