-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unexpected UnmatchedPatternError #1
Comments
Yeah, this is another known issue I thought of but hadn't time to write down to "known issues" yet. I'll try to fix this one, thanks. |
The only way to fix this w/o changing syntax (at least the only I can think of) would be to track If changing syntax, it's quite easy to add intermediate step like match(obj, [
({ x }) => () => console.log('x', x),
({ y }) => () => console.log('y', y),
({ z }) => () => console.log('z', z),
// Exhaustive match; will throw `xmatch.UnmatchedPatternError` unless uncommented:
// other => console.error('Something else', other),
]); but I don't really like it... One another way would be to add I'm not sure what would be the cleanest way yet, but I'm open to suggestions. |
The intermediate step approach seems like the most sane one: little-to-none performance impact, no need to |
Actually got one more idea how to do it: similarly to how I just implemented iterable support, I can detect end of iteration for unwrapping. In that case, one one hand, match([ obj ], [
([{ x }]) => console.log('x', x),
([{ y }]) => console.log('y', y),
([{ z }]) => console.log('z', z),
]); |
Expected:
undefined
The text was updated successfully, but these errors were encountered: