We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
with(P.not([])
Describe the bug not able to match the empty array pattern with readonly array. from the code below, a must not inferred as empty array
readonly array
a
of course I could match .with([], ...) before P.not([]), but seems this case is broken. awkwardly, the runtime evaluates b in this case.
.with([], ...)
Code Sandbox with a minimal reproduction case
import { match, P } from 'ts-pattern'; const x:readonly number[] = [] match(x) .with(P.not([]),(a)=>a) // ^? [] | readonly [number, ...number[]] .otherwise(b=>b)
Versions
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
not able to match the empty array pattern with
readonly array
.from the code below,
a
must not inferred as empty arrayof course I could match
.with([], ...)
before P.not([]), but seems this case is broken.awkwardly, the runtime evaluates b in this case.
Code Sandbox with a minimal reproduction case
Versions
The text was updated successfully, but these errors were encountered: