microsoft / microsoft/TypeScript

Crash: TypeError: Cannot read properties of undefined (reading 'aliasSymbol') remains when using variadic tuple with (infer C)[] and constrained infer

未关闭
#63,199 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

### 🔎 Search Terms

aliasSymbol, inferFromTypes, variadic tuple, compiler crash

### 🕗 Version & Regression Information

Version: 5.7.3, 5.8.3, 5.9.3,nightly (Still crashing after PR for #63014 )

### ⏯ Playground Link

https://www.typescriptlang.org/zh/play/?target=7&ts=5.9.3#code/C4TwDgpgBAygrgIwCpzAHiQPigXikqCAD2AgDsATAZygG0AoKJqAOjYAoBLMgMwgCcoAYQCUtALoAaRszYtufQQCFCJctToBDMiElRtIcfXFQA-FBUAuKGQgA3AQG56oSPn6cA5p4G5YiFHRaAEY9ACZxTEcgA

### 💻 Code

```ts
type SubTup = T extends [
...(infer C)[],
...infer B extends [any, any]
] ? B : never;
type Trigger = SubTup<[1, 2]>;
```

### 🙁 Actual behavior

```
TypeError: Cannot read properties of undefined (reading 'aliasSymbol')
at inferFromTypes (D:\github\TypeScript\built\local\_tsc.js:68686:18)
at inferFromObjectTypes (D:\github\TypeScript\built\local\_tsc.js:69171:23)
at invokeOnce (D:\github\TypeScript\built\local\_tsc.js:68878:9)
at inferFromTypes (D:\github\TypeScript\built\local\_tsc.js:68840:11)
at inferTypes (D:\github\TypeScript\built\local\_tsc.js:68674:5)
at getConditionalType (D:\github\TypeScript\built\local\_tsc.js:62706:11)
at getConditionalTypeInstantiation (D:\github\TypeScript\built\local\_tsc.js:63695:307)
at instantiateTypeWorker (D:\github\TypeScript\built\local\_tsc.js:63798:14)
at instantiateTypeWithAlias (D:\github\TypeScript\built\local\_tsc.js:63735:20)
at getTypeAliasInstantiation (D:\github\TypeScript\built\local\_tsc.js:60300:52)

Node.js v22.19.0
```

### 🙂 Expected behavior

The compiler should not crash.

### Additional information about the issue

I noticed that while PR #63014 fixed some crashes related to variadic tuples, the compiler still crashes (ICE) when using a slightly different syntax.

贡献指南

打开贡献指南

从这里开始

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

调研方向

在 Playground 链接中或编译器内重现 variadic-tuple 代码片段,然后通过 built/local/_tsc.js 跟踪调用栈,尤其关注 inferFromTypes 和 inferFromObjectTypes。将剩余的失败与 PR #63014 进行比较;完成的标准是该示例不再产生 aliasSymbol TypeError,也不再导致编译器崩溃。

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

评估

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

把新 issue 发到你的邮箱

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