Skip to content

Conversation

@bloadvenro
Copy link
Contributor

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.

@vercel
Copy link

vercel 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
Copy link
Member

zerobias commented Oct 6, 2019

Wow, amazing! 😃 Big thanks!

@zerobias zerobias merged commit 880c2f3 into effector:master Oct 6, 2019
@bloadvenro bloadvenro deleted the ts-infer-optional-params-from-effect-handler branch October 11, 2019 17:58
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