Skip to content

Compiler Error when implementing Redux-Thunk Action #559

@mkschnitzel

Description

@mkschnitzel

This is a...

  • feature request
  • bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

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 #390 a while ago,
but might have been broken again in commit 5ab400f#diff-0d3376051b12933294267bc5c76dac1c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions