angular / angular/components

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

Open
#27,718 1 comment 1 reaction 1 assignee Claimed by @crisbeto View on GitHub
area: cdk/coercion docs P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.