refactor(forms): Fix weak helper types in the Forms package#44370
refactor(forms): Fix weak helper types in the Forms package#44370dylhunn wants to merge 1 commit intoangular:masterfrom
Conversation
|
Presubmit for this change is green. |
e8884fd to
1d7a967
Compare
jessicajaniuk
left a comment
There was a problem hiding this comment.
LGTM 🍪
reviewed-for: public-api
AndrewKushnir
left a comment
There was a problem hiding this comment.
@dylhunn thanks for improving types! 👍
The change looks great, just left a couple comments/suggestions.
1d7a967 to
32121b5
Compare
AndrewKushnir
left a comment
There was a problem hiding this comment.
LGTM, thanks @dylhunn 👍
packages/forms/src/model.ts
Outdated
There was a problem hiding this comment.
I believe we could also specify the return type?
| _reduceChildren<T>(initValue: T, fn: (acc: T, control: AbstractControl, name: string) => T) { | |
| _reduceChildren<T>(initValue: T, fn: (acc: T, control: AbstractControl, name: string) => T): T { |
AndrewKushnir
left a comment
There was a problem hiding this comment.
Reviewed-for: public-api
32121b5 to
383af71
Compare
383af71 to
da86895
Compare
|
@alxhub I'm actually just going to drop the public API change from this PR -- I think it's still worth fixing the |
da86895 to
30f15a5
Compare
30f15a5 to
cbe02fb
Compare
|
FYI, this refuses to merge because the commit type is |
…Function` types that can be strengthened to specific callbacks. This was originally proposed as part of Typed Forms, but it may be possible to submit at least some of these changes separately and unconditionally (i.e. without relying on `TypedOrUntyped`.) It is desirable to land this separately to reduce the scope of the Typed Forms PR, by focusing it only on the new type parameters (rather than incidental strictness fixes).
cbe02fb to
eb731cf
Compare
|
@alxhub Fixed. |
|
This PR was merged into the repository by commit 7df9127. |
…Function` types that can be strengthened to specific callbacks. This was originally proposed as part of Typed Forms, but it may be possible to submit at least some of these changes separately and unconditionally (i.e. without relying on `TypedOrUntyped`.) (#44370) It is desirable to land this separately to reduce the scope of the Typed Forms PR, by focusing it only on the new type parameters (rather than incidental strictness fixes). PR Close #44370
I previously strengthened some weak types in angular#44370. One of these fixes exposed an incorrect call into `_reduceChildren` from `_reduceValue`. This was caught in google3 by a caller who was extending `FormGroup` and overriding these methods. Special thanks to Bart G for catching this issue and suggesting a fix.
) I previously strengthened some weak types in #44370. One of these fixes exposed an incorrect call into `_reduceChildren` from `_reduceValue`. This was caught in google3 by a caller who was extending `FormGroup` and overriding these methods. Special thanks to Bart G for catching this issue and suggesting a fix. PR Close #44483
) I previously strengthened some weak types in #44370. One of these fixes exposed an incorrect call into `_reduceChildren` from `_reduceValue`. This was caught in google3 by a caller who was extending `FormGroup` and overriding these methods. Special thanks to Bart G for catching this issue and suggesting a fix. PR Close #44483
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fix weak helper types in the Forms package, mostly
Functiontypes that can be strengthened to specific callbacks. This was originally proposed as part of Typed Forms, but it should be possible to submit at least some of these changes separately and unconditionally (i.e. without relying onTypedOrUntyped.)It is desirable to land this separately to reduce the scope of the Typed Forms PR, by focusing it only on the new type parameters (rather than incidental strictness fixes).
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Many forms methods have unnecessarily weak types (e.g.
Function).Issue Number: #13721
What is the new behavior?
The types of these methods are strengthened to specific callbacks.
Does this PR introduce a breaking change?
No
Other information