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

Check if union covers all cases even if the current case is satisfied. #52

Open
JAForbes opened this issue Oct 19, 2016 · 0 comments
Open

Comments

@JAForbes
Copy link

I'd like to receive a type error if a case function is missing cases.
union-type already does this but it will only throw if the current case is missing - which makes it quite likely that you miss a substantial set of bugs ( and the main benefit of union types ).

An example:

const User = Type({
  Guest: []
  Registered: []
})

const registered = User.Registered()

User.case({
  Registered: console.log
}, registered)

The above doesn't fail, even though the case is not handling all domains. It should check if the case function has the same keys as the Type definition.

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

No branches or pull requests

1 participant