数组完整性检查不正确

作者: KristianBalaj创建于 2025年10月15日更新于 2025年10月15日

描述错误 具有以下模式匹配:

match(a)
  .with([], () => {
    console.log('Empty');
  })
  .with([P.select()], (_) => {
    console.log('one');
  })
  .with([P._, P._, ...P.array()], (_) => {
    console.log('some');
  })
  .exhaustive();

调用 exhaustive() 时出现错误: 此表达式不可调用。类型 'NonExhaustiveError<[bigint, ...bigint[]]>' 没有调用签名。

然而,模式匹配是完全的。没有任何值不会被此匹配匹配。

内容来源: gvergnaud/ts-pattern