tshaddix / webext-redux

A set of utilities for building Redux applications in Web Extensions.
MIT License
1.23k stars 180 forks source link

saga middleware typescript problem #278

Closed cerenkeklik closed 2 years ago

cerenkeklik commented 2 years ago

I am working on a project that creates a google chrome extension. I am trying to add redux-saga middleware for using saga debounce. However, I am getting an error that says: Argument type is not assignable of type 'StoreEnhancers<unknown, {}>'. How can I fix that and How should I do that? There are not various example in the internet in web extension with middleware. Thanks for your time.

image

Here is my code:

background.ts

const middleware = [saga]
const store = createStore(reducer, initialState, applyMiddleware(...middleware))
// a normal Redux store
const storeWithMiddleware = wrapStore(store, { portName: 'bla' })

popup.tsx

const store = new Store({ portName: 'bla' })

// wait for the store to connect to the background page
store
  .ready()
  .then(() => {
    // The store implements the same interface as Redux's store
    // so you can use tools like `react-redux` no problem!
    const root = document.createElement('div')
    document.body.appendChild(root)

    ReactDOM.render(
      <Provider store={store}>
        <App />
      </Provider>,
      root
    )
  })
  .catch((e) => console.log(e))
//});
export default store