Skip to content

Incorrect array exhaustiveness check #335

@KristianBalaj

Description

@KristianBalaj

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions