angular-redux / form

Keep your Angular2+ form state in Redux
MIT License
41 stars 15 forks source link

TypeScript >= 2 `strictNullChecks` breaks #26

Closed bennett000 closed 7 years ago

bennett000 commented 7 years ago

This is a...

What toolchain are you using for transpilation/bundling?

Environment

NodeJS Version: 8.0.0 Typescript Version: 2.2.2 Angular Version: 4.1.3 @angular-redux/store version: 6.4.3 @angular/cli version: 1.0.6 OS: OS X

Expected Behaviour:

Programs with TypeScript's strictNullChecks enabled should compile to JavaScript

Actual Behaviour:

TypeScript gets angry about nulls since they're no longer automagically unioned with every type in strictNullChecks mode

Stack Trace/Error Message:

ERROR in ~/node_modules/@angular-redux/form/source/state.ts (79,32): Argument of type 'null' is not assignable to parameter of type 'string | number'.

ERROR ~/node_modules/@angular-redux/form/source/state.ts (100,39): Argument of type 'null' is not assignable to parameter of type 'string | number'.

ERROR in ~/node_modules/@angular-redux/form/source/compose-reducers.ts (15,7): Type 'null' is not assignable to type 'State'.

ERROR in ~/node_modules/@angular-redux/form/source/compose-reducers.ts (27,42): Argument of type 'null' is not assignable to parameter of type 'string | number'.

ERROR in ~/node_modules/@angular-redux/form/source/form-reducer.ts (19,20): Type 'Keyed<string, any> | RootState | undefined' is not assignable to type 'Keyed<string, any> | RootState'.
  Type 'undefined' is not assignable to type 'Keyed<string, any> | RootState'.

ERROR in ~/node_modules/@angular-redux/form/source/shims.ts (13,14): Type 'string[] | null' is not an array type.

ERROR in ~/node_modules/@angular-redux/form/source/shims.ts (18,24): Type 'null' is not assignable to type 'ControlValueAccessor'.

ERROR in ~/node_modules/@angular-redux/form/source/shims.ts (42,7): Variable 'customAccessor' is used before being assigned.

ERROR in ~/node_modules/@angular-redux/form/source/shims.ts (43,7): Variable 'builtinAccessor' is used before being assigned.

ERROR in ~/node_modules/@angular-redux/form/source/shims.ts (44,7): Variable 'defaultAccessor' is used before being assigned.

ERROR in ~/node_modules/@angular-redux/form/source/connect-array.ts (120,5): Type 'ValidatorFn | null' is not assignable to type 'ValidatorFn'.
  Type 'null' is not assignable to type 'ValidatorFn'.

ERROR in ~/node_modules/@angular-redux/form/source/connect-array.ts (124,5): Type 'AsyncValidatorFn | null' is not assignable to type 'AsyncValidatorFn'.
  Type 'null' is not assignable to type 'AsyncValidatorFn'.
SethDavenport commented 7 years ago

Should be fixed in @angular-redux/form@6.5.2