Closed sykesd closed 5 years ago
Just an update. I can remove the compiler error by changing my createSearchStore()
function to be:
import { Store } from "redux";
...
export const createSearchStore = () => createStore(reducerFunction) as unknown as Store;
but you don't do this in your example, unless your composeReducers
ends up having this effect?
Interesting. The store prop is just the Store
type from Redux:
But I guess we just loosen that type a bit since here's no need infer state or actions from it.
Loosened the store requirements in 0.5.1. Does it fix it for you?
Yes it does. Thank you. Upgraded to 0.5.2 and I was able to remove the 'as unknown as Store' type assertion.
Thanks.
@epeli Thanks for this an immer-reducer. The combination looks great and I hope for it to be able to reduce the boilerplate we have in a lot of our code.
I was trying this out today on a simple example, and I keep getting a TS2322 error on the line:
The
createMyStore
function looks like this:The
renderFunction
andProcedureSearchState
look like this:The full error message is:
I tried created a CodeSandox showing the error, but of course I don't get an error there.
I made sure I had the same
tsconfig.json
as your example here, but it made no difference. I still get the compiler error.What am I doing wrong? What other information do you need to help me debug this?
The demos and the description of this look really great, and I would really like to try it out on a more substantial example once I get the very basics working.