You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
Hey, I love reactn by the way :)
I have recently updated reactn from 1 to 2 in my application.
But I have a question with type inference.
I added a global.d.ts file in my root folder and there I declared the type for the State and Reducers.
If I use it like this the type inference is good.
But in the addReducer function (1ste pic) the item, type, and FilterKey are of type any. Why do these don't have the types through inference? Do I need to type them seperately?
Thank you very much.
The text was updated successfully, but these errors were encountered:
Thank you for reporting this.
I don't think the reducers interface is used as a part of adding the
reducer, only accessing it afterwards.
I think the idea was that you should be able to add a reducer without
defining it on that interface, allowing it to function with any type by
default.
I'll look into inferring it if it exists and falling back to any if it does
not.
In the meantime, you can add types to your parameters to resolve this.
Sorry for the delay. This fix will be out today in 2.1.5.
I have tested it in the docs directory of this repository, wherein it seems to be working correctly:
It's an odd fix because the reducers are self-referential (the dispatch parameter references all other reducers, including itself), so if you run into any issues or bugs, just let me know, and I'll dig into it further.
As an addendum to your personal use case, you may want type to be keyof State or an enum of properties that are arrays (and can be filtered).
Hey, I love reactn by the way :)
I have recently updated reactn from 1 to 2 in my application.
But I have a question with type inference.
I added a global.d.ts file in my root folder and there I declared the type for the State and Reducers.
If I use it like this the type inference is good.
But in the addReducer function (1ste pic) the item, type, and FilterKey are of type any. Why do these don't have the types through inference? Do I need to type them seperately?
Thank you very much.
The text was updated successfully, but these errors were encountered: