microsoft / microsoft/TypeScript

Error: Debug Failure. No error for last overload signature

未关闭
#61,524 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Domain: check: Variance Relationships Help Wanted
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

### 🔎 Search Terms

The TypeScript compiler crashs with the message "Error: Debug Failure. No error for last overload signature". (Check the DevTools console for the error message in the TypeScript Playground).

I've found issue #60229, which has the same error message. However, I am not sure if the root cause is the same.

### 🕗 Version & Regression Information

- The problem appears in the latest nightly version (v5.9.0-dev.20250403)
- This changed between versions 3.5.1 and 3.6.2 (in the Playground it works in 3.5.1 but not in 3.6.2 anymore)

### ⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.9.0-dev.20250403#code/C4TwDgpgBA4hB2EBOBLAxgHgCoD4oF4osoIAPYBAEwGcoBDeEAbQF0oB+Ip+AVwFsARsjYAuLgGsIIAPYAzIiwDcAKGVkw0pMCiye8NMBTT4UCtWAAxeBgCCJclVoAlCGk2UM51PADmAGnpGHBwACmUoKGkBACsxGz9wqDQBMRCU2ARkdAwABTotFDoAG1tggEoCPAYQZQqAb0TZTSgQt3hzKCZJEACAN2K2OSgAeRjXYAA6BGBUCGoQqOiy+sSI5JD+ovpaOERUTBscMpUIgF9lc6A

### 💻 Code

```ts
type Generic = T extends any[] ? T[number] : T[keyof T];

export function testFn>(
obj: A,
cb: (b: Generic>) => any
) {
for (const [key, val] of Object.entries(obj)) {
cb(val as Generic
);
}
}
```

### 🙁 Actual behavior

The compiler crashs with:
```
Error: Debug Failure. No error for last overload signature
at resolveCall (M:\websites\app\node_modules\typescript\lib\_tsc.js:75576:19)
at resolveCallExpression (M:\websites\app\node_modules\typescript\lib\_tsc.js:75970:12)
at resolveSignature (M:\websites\app\node_modules\typescript\lib\_tsc.js:76398:16)
at getResolvedSignature (M:\websites\app\node_modules\typescript\lib\_tsc.js:76425:20)
at checkCallExpression (M:\websites\app\node_modules\typescript\lib\_tsc.js:76533:23)
at checkExpressionWorker (M:\websites\app\node_modules\typescript\lib\_tsc.js:79950:16)
at checkExpression (M:\websites\app\node_modules\typescript\lib\_tsc.js:79849:32)
at checkExpressionCached (M:\websites\app\node_modules\typescript\lib\_tsc.js:79473:28)
at checkVariableLikeDeclaration (M:\websites\app\node_modules\typescript\lib\_tsc.js:82311:35)
at checkVariableDeclaration (M:\websites\app\node_modules\typescript\lib\_tsc.js:82407:5)
```

### 🙂 Expected behavior

That the compiler does not crash.

### Additional information about the issue

Changing
```
cb: (b: Generic>) => any
```
to
```
cb: (b: Partial>) => any
```
prevents the error. However, this only addresses the symptoms rather than the root cause.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用链接的 nightly 版本和提供的泛型回调示例,在 TypeScript Playground 中重现崩溃。从堆栈跟踪中显示的 resolveCall 和 resolveCallExpression 条目开始,将行为与 3.5.1 和 3.6.2 版本进行比较,并验证编译该示例不再崩溃。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。