Flow-typed: Mismatch Reducer definitions in redux & redux-actions

Created on 14 Mar 2018  路  3Comments  路  Source: flow-typed/flow-typed

I now get errors in my project in redux-actions:

This parameter is incompatible:
    30:   declare export type Reducer<S, A> = (state: S | void, action: A) => S;
                                                      ^^^^^^^^ undefined. This type is incompatible with. See lib: flow-typed/npm/redux_v3.x.x.js:30
    58: }, defaultState)
          ^^^^^^^^^^^^ object literal. See: app/reducers/appointmentsDurations.js:58

After digging into it, I believe it's due to #1958. The state's type in the reducer in redux is now S | void, but in redux-actions, it's still just S. So redux-action returns a different type of reducer to createStore and breaks there I believe.

bug libdef

Most helpful comment

I was wondering why redux-actions re-defines a type like Reducer instead of importing the one from the redux libdef

Flow-typed doesn't yet have the ability to import definitions for other libdefs, although it is set as a target for version 3.0.0.

All 3 comments

Thanks for reporting this issue, would you be up to write a fix for redux-actions?

I tried to fix this, but got issues trying to fix the tests and didn't have much time. I can give it another go soon. Since redux-actions has to work with redux, I was wondering why redux-actions re-defines a type like Reducer instead of importing the one from the redux libdef?

I was wondering why redux-actions re-defines a type like Reducer instead of importing the one from the redux libdef

Flow-typed doesn't yet have the ability to import definitions for other libdefs, although it is set as a target for version 3.0.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oriSomething picture oriSomething  路  4Comments

fabulator picture fabulator  路  3Comments

EvHaus picture EvHaus  路  4Comments

gabelevi picture gabelevi  路  3Comments

NotTooReact89 picture NotTooReact89  路  4Comments