Skip to content

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

Description

@NullVoxPopuli

🔎 搜索 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

Metadata

Metadata

Assignees

No one assigned

    标签

    BugA bug in TypeScript

    Type

    No type

    项目

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions