Open LaurensRietveld opened 9 months ago
Note that I managed to work around this myself by extending the OR
function and its types:
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 IOrAlt
types and not the OrMethodOpts
types), but it suffices for my usecase
Hello @LaurensRietveld
Could this be extended in a generic manner to improve the Chevrotain types?
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