angular-docs-cn/packages/forms
Dylan Hunn e49fc96ed3 feat(forms): Make Form Statuses use stricter types. (#42952)
Specifically: narrow the type used for form statuses from string to a union of possible statuses. Change the API methods from any to use the new type.

This is a breaking change. However, as discussed in the PR, breakage seems minimal, and google3 has been prepped to land this.

Background: we uncovered these any typings in the course of design work for typed forms. They could be fixed in a non-breaking manner by piggybacking them on top of the new typed forms generics, but it would be much cleaner to fix them separately if possible.

BREAKING CHANGE:

A new type called `FormControlStatus` has been introduced, which is a union of all possible status strings for form controls. `AbstractControl.status` has been narrowed from `string` to `FormControlStatus`, and `statusChanges` has been narrowed from `Observable<any>` to `Observable<FormControlStatus>`. Most applications should consume the new types seamlessly. Any breakage caused by this change is likely due to one of the following two problems: (1) the app is comparing `AbstractControl.status` against a string which is not a valid status; or, (2) the app is using `statusChanges` events as if they were something other than strings.

PR Close #42952
2021-08-04 16:28:20 -07:00
..
src feat(forms): Make Form Statuses use stricter types. (#42952) 2021-08-04 16:28:20 -07:00
test feat(forms): add hasValidators, addValidators, and removeValidators methods (for both sync and async) (#42838) 2021-07-22 16:31:00 +00:00
BUILD.bazel build: use api-golden tool from dev-infra for testing public API (#42688) 2021-06-30 11:43:48 -07:00
PACKAGE.md docs: more form overview edits (#25663) 2018-09-25 18:48:15 -07:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json refactor(core): update peerDependencies to allow rxjs7 (#42991) 2021-08-02 13:55:01 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00