Skip to content

Misplaced or partially removed comments in emitted code #32813

Closed
@falsyvalues

Description

@falsyvalues

TypeScript Version: 3.5.1

Search Terms:
comments comment mangling emitted code doc docs strip code

Code
Especially annoying problem while using tools like strip code etc.

class ABC {
    // #DEBUG
    private a () {}
    // #ENDDEBUG
    public z = 1;
}

Expected behavior:

"use strict";
class ABC {
    constructor() {
        this.z = 1;
    }
    // #DEBUG
    a() { }
    // #ENDDEBUG
}

Actual behavior:

"use strict";
class ABC {
    constructor() {
        // #ENDDEBUG
        this.z = 1;
    }
    // #DEBUG
    a() { }
}

Playground Link:
Misplaced:
http://www.typescriptlang.org/play/#code/MYGwhgzhAECCBCBhaBvAUNT0D03oGIARAUXgFUBxDLABwCcBLANzABcBTaMaACgEpUAX2qZcBYgDlCJclSzQaAVwBGIBsGgAvaAF5oARgDcaQUA
Removed:
http://www.typescriptlang.org/play/#code/MYGwhgzhAECCBCBhaBvAUNT0D03oGIARAUXgFUBxDLABwCcBLANzABcBTaMaACgEpUAX2qZcBYgDlCJclUFA

Related Issues:
Checked #1311 and #10385. The #1311 works better but still failing in one case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions