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

JSDoc @typedef property description lost #35346

Open
mjbvz opened this issue Nov 26, 2019 · 3 comments
Open

JSDoc @typedef property description lost #35346

mjbvz opened this issue Nov 26, 2019 · 3 comments
Labels
Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Domain: Quick Info e.g. hover text, tool-tips, and tooltips.
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 26, 2019

TypeScript Version: 3.8.0-dev.20191125

Search Terms:

  • jsdoc
  • typedef
  • property

Repo
For the JS:

/** @typedef {Object.<string, any>} type
 * @property {string} prop1 - Missing Description 1
 * @property {string} prop2 - Missing Description 2
*/

/** @type {type} */
var a = {
    prop1: null,
    prop2: null
}

/** @type {type}
 * @class */
function b(){
    this.prop1 = null;
    this.prop2 = null;
}

var c = new b();

Type c.prop1 to view prop1 suggestion

Expected behavior:
Description from the typedef is shown: Missing Description 1

Actual behavior:
No description (but the property does have the correct type)

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Domain: Quick Info e.g. hover text, tool-tips, and tooltips. labels Jan 8, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jan 8, 2020
@edaanen
Copy link

edaanen commented Jun 16, 2021

Is there any news on this issue!? I have the same problem with the TS definition files of my libraries.
This works:
type Test
{
/** my prop description */
myProp: boolean;
}

but this doesn't work (and this is how all libraries are documented following JSDOC documentation):

    /**
     * @typedef {Object} borderPadding
     * @property width - <p>Total padding and border width.</p>
     * @property height - <p>Total padding and border height.</p>
     * @property borderTop - <p>The width of the top border.</p>
     * @property borderRight - <p>The width of the right border.</p>
     * @property borderBottom - <p>The width of the bottom border.</p>
     * @property borderLeft - <p>The width of the left border.</p>
     * @property paddingTop - <p>The width of the top padding.</p>
     * @property paddingRight - <p>The width of the right padding.</p>
     * @property paddingBottom - <p>The width of the bottom padding.</p>
     * @property paddingLeft - <p>The width of the left padding.</p>
     */
    type borderPadding = {
        width: number;
        height: number;
        borderTop: number;
        borderRight: number;
        borderBottom: number;
        borderLeft: number;
        paddingTop: number;
        paddingRight: number;
        paddingBottom: number;
        paddingLeft: number;
    };

@FireController1847
Copy link

I'd also be curious to know if there's any updates on this issue a year later.

@conlanpatrek
Copy link

As a workaround, I've noticed that I can document my descriptions on the following line and they will not be lost.

e.g.

    /**
     * @typedef {object}  Vector2
     * @property {number} x
     * My description for the x property
     * @property {number} y
     * My description for the y property
     */

It's not the JSDoc documented way to do this, but it seems to get intellisense to behave.

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: JSDoc Relates to JSDoc parsing and type generation Domain: Quick Info e.g. hover text, tool-tips, and tooltips.
Projects
None yet
Development

No branches or pull requests

5 participants