Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom mutator docs and types fix #53

Merged
merged 2 commits into from
Jan 19, 2020

Conversation

albertogasparin
Copy link
Collaborator

Current TS type definition does not allow customisation of setState to accomodate a custom mutator. By using an interface we can overload setState definition tu allow custom arguments (like a function).
I've also relaxed the types of the default mutator so TS does not complain on the actual implementation of it and setState can be called with anything.

@albertogasparin
Copy link
Collaborator Author

Fixes #52

@mattbajorek
Copy link

Hi Alberto. My previous account was deleted, but I have tested these new changes. It looks great, except there should be a note in the docs about if immerjs is used with overriding the SetState interface, the TState used must not be a Readonly type since the TState is a draft state.

@albertogasparin albertogasparin merged commit abecbc0 into master Jan 19, 2020
@albertogasparin albertogasparin deleted the fix/custom-mutator-types branch January 19, 2020 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants