angular / angular/components

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

Ouverte
#27,718 1 commentaire 1 réaction 1 personne assignée Réclamée par @crisbeto Voir sur GitHub
area: cdk/coercion docs P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

### 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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.