#972·rematch

[Typescript] Faulty types

Author: darklight9811Created May 29, 2022Updated Jul 18, 2023

Describe the bug

Since 2.1.1, the reducers generated by rematch are wrongly typed. They ask for the last state when calling a reducer.

Reproduce Link link

To Reproduce

Create a model and a store, access the model through the dispatch in the store. You will see that the arguments of the reducer are wrongly typed.

Expected behavior

The reducer to match the function used in the createModel funciton, to not require the store (since if you add it you will break the function call) and have the according type.

Screenshots

image

Desktop

  • OS: Windows, Linux
  • Browser (not related to browser)
  • Version (the last version working is 2.1.0, everything after that is broken)

Additional context

It used to work, now I'm locked in older versions because of this.