Skip to content

Trim trailing whitespace in d.ts output #4629

Closed
@jednano

Description

@jednano

Here's a scenario in which trailing whitespace is not trimmed in d.ts output, specifically when adding jsdoc-style comments above each arg with line breaks in-between:

export class Point {
    constructor(
        /**
         * The x coordinate.
         */
        public x: number,
        /**
         * The y coordinate.
         */
        public y: number
    ) {

    }
}

The generated output has spaces after each argument's comma that has another argument after it. In this case, only the x arg has the space after the comma:

define(["require", "exports"], function (require, exports) {
    var Point = (function () {
        function Point(
            /**
             * The x coordinate.
             */
            x, <-- trailing whitespace!
            /**
             * The y coordinate.
             */
            y) {
            this.x = x;
            this.y = y;
        }
        return Point;
    })();
    exports.Point = Point;
});

See the result on the TypeScript Playground.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions