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

Ts infer optional params from effect handler #214

Conversation

@bloadvenro
Copy link
Contributor

bloadvenro commented Oct 6, 2019

The problem with current createEffect typescript typings is that FN extends () => infer Done condition satisfies zero-or-one-arity effect handlers. Handler like (x?: TYPE) => any will produce Effect<void,...>. New test suite with updated snapshots displays these errors.

You may see new typings proposal partially improving current situation. I added some comments to explain why it was difficult to deal with type any.

The last commit contains finally updated snapshots to demonstrate how proposed typings work.

@now

This comment has been minimized.

Copy link

now bot commented Oct 6, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://effector-git-fork-bloadvenro-ts-infer-optional-par-adab11.zerobias.now.sh

@zerobias

This comment has been minimized.

Copy link
Owner

zerobias commented Oct 6, 2019

Wow, amazing! 😃 Big thanks!

@zerobias zerobias merged commit 880c2f3 into zerobias:master Oct 6, 2019
4 checks passed
4 checks passed
common-tests
Details
WIP Ready for review
Details
now Deployment has completed
Details
semaphoreci The build passed on Semaphore.
Details
@bloadvenro bloadvenro deleted the bloadvenro:ts-infer-optional-params-from-effect-handler branch Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.