krasimir / kuker

Kick-ass browser extension to debug your apps
https://chrome.google.com/webstore/detail/glgnienmpgmfpkigngkmieconbnkmlcn
MIT License
657 stars 26 forks source link

how to use with redux saga and typescript? #10

Closed szkrd closed 5 years ago

szkrd commented 5 years ago

I'm trying to integrate kuker with react-readux-saga, but I'm stuck here:

const sagaMiddleware = createSagaMiddleware({
  sagaMonitor: emitter.sagaMonitor
})

Because the createSagaMiddleware expects an emitter function as well:

export default function sagaMiddlewareFactory<T>(options?: {
  sagaMonitor?: Monitor;
  emitter: (emit: Emit<T>) => Emit<T>;
}): SagaMiddleware;

Am I missing something?

We are using "react-redux": "^5.0.3" + "redux": "^3.6.0" + "redux-saga": "0.14.8" with react 16

The error is:

[tsl] ERROR in index.ts(31,45)
      TS2345: Argument of type '{ sagaMonitor: any; }' is not assignable to parameter of type '{ sagaMonitor?: Monitor; emitter: (emit: Emit<{}>) => Emit<{}>; }'.
  Property 'emitter' is missing in type '{ sagaMonitor: any; }'.
i 「wdm」: Failed to compile.
krasimir commented 5 years ago

Hello,

sorry for the delay. I don't have experience with TypeScript but as far as I can see Kuker's saga monitor is not meeting the Monitor type. If you can dig a little bit and tell me how what it means to provide a Monitor type I'm happy to make a change so everything works as expected.

szkrd commented 5 years ago

Thank you! It seems to me that our redux saga dependency is way too old, this shouldn't happen indeed.

The d.ts file is out of date, the relevant upstream issue is (was) here:

https://github.com/redux-saga/redux-saga/issues/813