angular-redux / store

Angular 2+ bindings for Redux
MIT License
1.34k stars 202 forks source link

Compiler Error when implementing Redux-Thunk Action #559

Open mkschnitzel opened 5 years ago

mkschnitzel commented 5 years ago

This is a...

What toolchain are you using for transpilation/bundling?

Environment

NodeJS Version: 10.15.3 Typescript Version: 3.2.4 Angular Version: 7.2.15 @angular-redux/store version: 10.0.0 @angular/cli version: 7.3.9 OS: Win7

Link to repo showing the issus

(optional, but helps a lot)

Expected Behaviour:

Implemented Redux-Thunk (2.3.0) Called a redux-thunk-action via dispatch No compiler errors

Actual Behaviour:

Compiler error

Stack Trace/Error Message:

TS2345 (TS) Argument of type '(dispatch: any, getState: any) => void' is not assignable to parameter of type 'AnyAction'. Property 'type' is missing in type '(dispatch: any, getState: any) => void' but required in type 'AnyAction'.

Additional Notes:

Workaround: Cast the returning function of the redux-thunk-action as \<AnyAction>\<any> Example: return \<AnyAction>\<any>((dispatch, getState) => { ..... }

This seemed to be fixed https://github.com/angular-redux/store/pull/390 a while ago, but might have been broken again in commit https://github.com/angular-redux/store/commit/5ab400fa08908dc763e3b4a0fa75387954ae63a1#diff-0d3376051b12933294267bc5c76dac1c