no0x9d / ngx-strongly-typed-forms

Strongly typed definitions for Anglulars `@angular/forms`
MIT License
59 stars 11 forks source link

reset can break type safety #25

Open RohanHart opened 4 years ago

RohanHart commented 4 years ago

reset() sets the control's value to null even if the generic value for the control excludes null.

I can't find a typing which prevents calling reset in this case so there seem two choices:

  1. change to value: T | null which will require null checks everywhere
  2. require the reset value to be passed which is a breaking change
RohanHart commented 4 years ago

FormArray and FormGroup are more problematic as if a value is not provided for every child control some of those will be reset to null