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


Copy link

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.


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:


This comment has been minimized.

Copy link

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
WIP Ready for review
now Deployment has completed
semaphoreci The build passed on Semaphore.
@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
None yet
2 participants
You can’t perform that action at this time.