-
-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Hey, first of all thanks for the awesome library 🙏 I have a small issue where .match() with .exhaustive() is not working with a readonly array, I included screenshots of the issue.
match(value) // value: string | Date | readonly string[]
.with(P.string, (value) => ...)
.with(P.array(P.string), (value) => ...)
.with(P.instanceOf(Date), (value) => ...)
.exhaustive() // Complains about "Type 'NonExhaustiveError<readonly string[]>' has no call signatures."Interestingly enough, the value is correct inside the P.array(P.string)) condition: value: string[] | readonly string[].
TypeScript playground with a minimal reproduction case
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbziAhjAxgCwDRwApwC+cAZlBCHAOQwDOAtGGjAKZQB2VAUFzAJ5gWcAGooANgFchAXji0YUYOwDmcAD5woLFABMI7MXzkKlygNoBddXAAiaFgG4eOlujEotcdPvlwAbuJSAFwigY48qBiYABQBkiwAlFxwKXAAdADuwDAxeGnyiiq4sWEJcNIAfHAAjEmp6Vk50XkeUCh8zfkmKgnFcVJllXAATHWpmdm5aUryKOzoLADyJNF2rL1wJfGDVQDMYylpLAAemCgS8sB+LNFJQA
Versions
- TypeScript version: 5.4.2
- ts-pattern version: 5.2.0
- environment: node v18.15.0

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working