bmealhouse/next-redux-saga

Typescript definitions

virzak opened this issue · 7 comments

Hello,

Are typescript definitions available for this project?

No they aren't. Are you interested in making a PR to add them?

Here is a very simple typing that seems to do the job at least for the basic setup. I'm using it in my app with no problems.

declare module 'next-redux-saga' {
  function withReduxSaga<T extends React.Component>(arg: function | Partial<{[index : string] : any; async: boolean; }>) : T
  export default withReduxSaga;
}

Thanks for sharing @richbai90.

Thanks @richbai90
I slightly modified to:

declare module "next-redux-saga" {
  function withReduxSaga<P = any>(arg: function | Partial<{ [index: string]: any; async: boolean; }>): ComponentType<P>
  export default withReduxSaga;
}

Because of next-redux-wrapper expecting a ComponentType<P = {}>.

If either of you are interested, feel free to submit a PR to definitely typed.

I think you can close this now ;)

Much appreciated @leocavalcante!