microsoft / microsoft/TypeScript

TS7: `@extends` is ignored when the heritage is a call expression (Base.extend())

未关闭
#64,058 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

### 🔎 Search Terms

`extends js TS7 jsdoc`

nothing seemed directly related

### 🕗 Version & Regression Information

```
"typescript-7": "npm:typescript@7.1.0-dev.20260826.1"
```

### ⏯ Playground Link

https://github.com/NullVoxPopuli-ai-agent/typescript-go-jsdoc-extends-call-heritage

### 💻 Code

https://github.com/NullVoxPopuli-ai-agent/typescript-go-jsdoc-extends-call-heritage

```js
// @ts-check

/**
* @template T
*/
class Base {
/** @returns {T} */
get value() {
throw new Error();
}
/** @returns {typeof Base} */
static extend() {
return this;
}
}

/** @extends {Base} */
class ViaCall extends Base.extend() {}

/** @extends {Base} */
class ViaIdentifier extends Base {}

/** @type {string} */
const a = new ViaIdentifier().value; // ok in both

/** @type {string} */
const b = new ViaCall().value; // error in TS 7 only
```

### 🙁 Actual behavior

```
Version 7.1.0-dev.20260826.1
repro.js:18:23 - error TS8026: Expected Base type arguments; provide these with an '@extends' tag.

18 class ViaCall extends Base.extend() {}
~~~~~~~~~~~~~

Found 1 error in repro.js:18
```

### 🙂 Expected behavior

no error in TS7

### Additional information about the issue

_No response_

贡献指南

打开贡献指南

从这里开始

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

调研方向

先从链接的复现用例及其 repro.js 示例开始,然后使用所引用的 TypeScript 7.1.0-dev 构建运行它,以确认 ViaCall 上的 TS8026 诊断。将 Base.extend() 继承情况与正常工作的 Base 标识符情况进行比较,并定位涉及的 JSDoc @extends 处理逻辑。当调用表达式情况不产生错误,同时现有行为保持不变时,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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