Skip to content

[WIP] feat(forms): add type information for ControlValueAccessor<T>#19340

Closed
dherges wants to merge 1 commit intoangular:masterfrom
dherges:forms/types-control-value-accessor
Closed

[WIP] feat(forms): add type information for ControlValueAccessor<T>#19340
dherges wants to merge 1 commit intoangular:masterfrom
dherges:forms/types-control-value-accessor

Conversation

@dherges
Copy link
Contributor

@dherges dherges commented Sep 22, 2017

WIP

Resolves #19329

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] angular.io application / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: Resolves #19329

What is the new behavior?

Resolves #19329

Does this PR introduce a breaking change?

[x] Yes
[ ] No

Adds generic type information to ControlValueAccessor.

Prior: ControlValueAccessor
Now: ControlValueAccessor<T>

Soft migration strategy is to add ControlValueAccessor<any> to existing implementations.

Other information

@dherges dherges changed the title feat(forms): add type information for ControlValueAccessor<T> [WIP] feat(forms): add type information for ControlValueAccessor<T> Sep 22, 2017
@dherges
Copy link
Contributor Author

dherges commented Sep 22, 2017

Adding ControlValueAccessor<T> affects 22 places in source code ... 17 in @angular/forms + 5 in tests:

packages/forms/src/directives/checkbox_value_accessor.ts(35,54): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/ng_control.ts(31,18): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/ng_model.ts(167,31): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/number_value_accessor.ts(38,45): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/radio_control_value_accessor.ts(92,51): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/range_value_accessor.ts(38,44): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/reactive_directives/form_control_directive.ts(81,31): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/reactive_directives/form_control_name.ts(100,70): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/select_control_value_accessor.ts(98,52): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/select_multiple_control_value_accessor.ts(78,60): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(166,50): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(182,37): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(182,62): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(185,24): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(186,24): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(187,23): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/src/directives/shared.ts(188,30): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/test/directives_spec.ts(16,44): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/test/directives_spec.ts(104,33): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/test/value_accessor_integration_spec.ts(1316,31): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/test/value_accessor_integration_spec.ts(1331,33): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).
packages/forms/test/value_accessor_integration_spec.ts(1375,43): error TS2314: Generic type 'ControlValueAccessor<T>' requires 1 type argument(s).

@dirkluijk
Copy link
Contributor

Suggestion: make the generic type optional as described in #23126. This will make the proposed change fully BC.

@AndrewKushnir
Copy link
Contributor

Closing this WIP PR in favor of #31801.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(forms) Add types for "OnChangeCallback" and "OnTouchedCallback"

6 participants