futurGH/ts-to-jsdoc

not generating JSDoc for constructors and getters/setters

Closed this issue · 1 comments

The ts-to-jsdoc complier (as of v2.0.0) does not seem to generate jsdoc type annotations for constructors, getters or setters. In this (contrived, for the purpose of demonstration) example I would expect type annotations for the constructor and the getters and setters but none are generated:

input:

/**
represents a point in 2d space
*/
class Point {
	#x: number
	y: number
	/** creates a new point */
	constructor(x: number,y: number) {
		this.x = x
		this.y = y
	}
	
	/** adds another point to this one and returns the result */
	add(p : Point) : Point {
		return new Point(this.x + p.x, this.y + p.y)
	}
	
	/** gets the value of X */
	get x(): number {
		return this.#x
	}
	
	/** sets the value of x */
	set x(arg: number) {
		this.#x = arg
	}
}

I would expect the output to contain jsdoc @param for the getter, setter and constructor, but it only has it for the add method, with the type information for the getters and setters just stripped:

/**
represents a point in 2d space
*/
class Point {
    #x;
    y;
    /** creates a new point */
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }
    /**
     * adds another point to this one and returns the result
     * @param {Point} p
     * @returns {Point}
     */
    add(p) {
        return new Point(this.x + p.x, this.y + p.y);
    }
    /** gets the value of X */
    get x() {
        return this.#x;
    }
    /** sets the value of x */
    set x(arg) {
        this.#x = arg;
    }
}

Fixed in 2.1.0!