Incorrect array exhaustiveness check
Author: KristianBalajCreated Oct 15, 2025Updated Oct 15, 2025
Describe the bug Having the following pattern matching:
match(a)
.with([], () => {
console.log('Empty');
})
.with([P.select()], (_) => {
console.log('one');
})
.with([P._, P._, ...P.array()], (_) => {
console.log('some');
})
.exhaustive();The exhaustive() call is erroring with error: This expression is not callable. Type 'NonExhaustiveError<[bigint, ...bigint[]]>' has no call signatures.
However, the pattern matching is exhaustive. There's no value that wouldn't be matched by this matching.
Versions
- TypeScript version: 5.9.2
- ts-pattern version: 5.8.0
- environment: node v24.4.1
Source: gvergnaud/ts-pattern