Skip to content

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

Description

@NullVoxPopuli

πŸ”Ž 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions