angular / angular/components

docs-bug(coercion): Add a statement on how these functions relate to the Angular@^16 input transformers

Abierto
#27,718 1 comentario 1 reacción 1 asignado Reclamado por @crisbeto Ver en GitHub
area: cdk/coercion docs P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

### Documentation Feedback

#18840 suggested input decorators for input coercion. It seems like they have finally landed in v16 in the form of the [transform property](https://angular.io/api/core/Input#transform) on the `Input()` decorator. It looks like CDK’s [coerceBooleanProperty](https://github.com/angular/components/blob/main/src/cdk/coercion/boolean-property.ts#L16) and Angular’s [booleanAttribute](https://github.com/angular/angular/blob/16.2.2/packages/core/src/util/coercion.ts#L21) even are the same function, albeit worded differently.

I would appreciate a documentation update either here in the coercion section or in the “base” Angular docs regarding the two approaches to coercion: Is one in some way superior to the other? Will CDK’s version get deprecated? Can/should code safely be upgraded from CDK conversion to ‘native’?

### Affected documentation page

https://material.angular.io/cdk/coercion/overview

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.