englercj / tsd-jsdoc

Compiles JSDoc annotated JavaScript into a Typescript Definition file (.d.ts)
MIT License
316 stars 42 forks source link

Enum comment on properties should be preserved #111

Closed ggrossetie closed 4 years ago

ggrossetie commented 4 years ago

Consider the following code:

/**
 * Enum for tri-state values.
 * @readonly
 * @enum {number}
 */
var triState = {
    /** The true value */
    TRUE: 1,
    /** The false value */
    FALSE: -1,
    /** @type {boolean} */
    MAYBE: true,
};

Currently the generated type definition is:

/**
 * Enum for tri-state values.
 * @readonly
 * @enum {number}
 */
declare enum triState {
    TRUE = 1,
    FALSE = -1,
    MAYBE = true
}

I think we should preserve comments on properties:

/**
 * Enum for tri-state values.
 * @readonly
 * @enum {number}
 */
declare enum triState {
    /** The true value */
    TRUE = 1,
    /** The false value */
    FALSE = -1,
    /** @type {boolean} */
    MAYBE = true
}
englercj commented 4 years ago

👍