Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriden properties in jsdoc annotation are not picked up in declaration file #44693

Closed
simonseyock opened this issue Jun 22, 2021 · 2 comments Β· Fixed by #46797
Closed

Overriden properties in jsdoc annotation are not picked up in declaration file #44693

simonseyock opened this issue Jun 22, 2021 · 2 comments Β· Fixed by #46797
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Help Wanted You can do this
Milestone

Comments

@simonseyock
Copy link

Bug Report

πŸ”Ž Search Terms

typescript jsdoc declaration override method property signature

πŸ•— Version & Regression Information

  • This changed between versions 3.8.3 and 3.9.7.

⏯ Playground Link

Example JavaScript with JSDoc

πŸ’» Code

/**
 * @typedef A
 * @property {string} a
 */

/**
 * @typedef B
 * @property {number} b
 */

class Base {
    /**
     * @type {A}
     */
    value;
}

class Test extends Base {
    /**
     * @type {A & B}
     */
    value;
}

πŸ™ Actual behavior

The declaration file does not contain a typing for the narrower type for value in class Test.

declare class Test extends Base {
}

πŸ™‚ Expected behavior

The declaration file should contain the narrower type for value.

declare class Test extends Base {
    /**
     * @type {A & B}
     */
    value: A & B;
}
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Help Wanted You can do this labels Jun 22, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jun 22, 2021
@ahocevar
Copy link

This bug is especially problematic when creating APIs with function overloads for event register functions, because it breaks what has been described in #25590 (comment).

@simonseyock
Copy link
Author

simonseyock commented Jun 29, 2021

I am trying to git bisect this bug but I am not able to build older versions of typescript or to run tests on older versions. Does this have to do with the dependency versions? This has to do with the dependency versions. Could someone give me a pointer on how to install the right ones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Help Wanted You can do this
Projects
None yet
3 participants