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

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

还没有人认领这个 Issue。

评估

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

调研方向

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

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

描述

Bug
🔎 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

// @ts-check

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

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

/** @extends {Base<string>} */
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<T> 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

主要语言
Go
星标
111k
派生
14.4k
平均合并
1 天 19 小时
30 天内合并 PR
117

贡献指南

打开贡献指南

从这里开始

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

microsoft/TypeScript 的其他 Issue

查看 microsoft/TypeScript 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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