-
Notifications
You must be signed in to change notification settings - Fork 200
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
Improved type-safety for OR #1986
Comments
Note that I managed to work around this myself by extending the public OR<A extends Array<IOrAlt<any>>>(alt: A) {
return super.OR(alt) as ReturnType<A[number]["ALT"]>;
} I understand that my types are incomplete (I'm only including the |
Hello @LaurensRietveld Could this be extended in a generic manner to improve the Chevrotain types?
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take this
OR
statement:The type of result is
any
, where I'd expect it to be of typestring | number
. Is there a reason why the returntype of theALT
functions isn't used instead?ps. Many thanks for this library! Enjoying the type safety and performance
The text was updated successfully, but these errors were encountered: