angular / angular/components

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

Aperta
#27,718 1 commento 1 reazione 1 assegnatario Rivendicata da @crisbeto Vedi su GitHub
area: cdk/coercion docs P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.