Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS2315: Type 'Middleware' is not generic #205

Closed
0x1ad2 opened this issue Jun 22, 2018 · 8 comments
Closed

TS2315: Type 'Middleware' is not generic #205

0x1ad2 opened this issue Jun 22, 2018 · 8 comments

Comments

@0x1ad2
Copy link

0x1ad2 commented Jun 22, 2018

Yesterday I included redux-thunk in my project as middleware and then TypeScript failed. I already read this #203 but I'm running react-redux: "5.0.7" and redux-thunk: "2.3.0" so updating Redux isn't an option.

ERROR in [at-loader] ./node_modules/redux-thunk/index.d.ts:14:84
    TS2315: Type 'Middleware' is not generic.

screen shot 2018-06-22 at 10 40 24

@laat
Copy link
Contributor

laat commented Jun 22, 2018

Maybe pin to [email protected] ?

@0x1ad2
Copy link
Author

0x1ad2 commented Jun 22, 2018

@laat trying that as we speak, also trying to downgrade Redux to version 4.x

@0x1ad2
Copy link
Author

0x1ad2 commented Jun 22, 2018

Pinning to [email protected] worked, but the bug still has to be fixed.
Redux thunk probably has a mismatch of parameters when calling Middleware from Redux

/**
 * A middleware is a higher-order function that composes a dispatch function
 * to return a new dispatch function. It often turns async actions into
 * actions.
 *
 * Middleware is composable using function composition. It is useful for
 * logging actions, performing side effects like routing, or turning an
 * asynchronous API call into a series of synchronous actions.
 */
export interface Middleware {
  <S>(api: MiddlewareAPI<S>): (next: Dispatch<S>) => Dispatch<S>;
}

@timdorr
Copy link
Member

timdorr commented Jun 22, 2018

You have to use Redux 4.0 with redux-thunk 2.3.0.

@timdorr timdorr closed this as completed Jun 22, 2018
@scamden
Copy link

scamden commented Aug 31, 2018

is it me or should that be major change? I install a minor update and am forced to make a major update to a core library? seems like this should have been redux-thunk 3.0.0 to me just sayin.

@MokumJ
Copy link

MokumJ commented Sep 6, 2018

It doesn't matter which version I use
4.0.0 with 2.3.0,
5.0.7 with 2.2.0
or the other way around, it keeps on giving this error.
Nobody has a workaround?

@misstonbon
Copy link

"redux-thunk": "2.2.0", change worked for me. I'm on "react-redux": "^5.0.6", "react-router-dom": "^4.2.2", "redux": "^3.7.2",

@riku179
Copy link

riku179 commented Oct 8, 2018

In my case, redux-localstorage has blocked version of redux in 3.7.0.
So after I remove redux-localstorage, it works fine in [email protected] and [email protected].
Check yarn list|grep redux and find any packages not using [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants