Skip to content

Regression: JSDoc '@public' comment on constructor parameter affects JS emit #38401

Closed
@rbuckton

Description

@rbuckton

TypeScript Version: 3.9.1-rc, 4.0.0-dev

Search Terms: jsdoc comment parameter property modifier constructor public private protected readonly

Code

// @allowJS: true
// @checkJS: true
// @out: output.js
// @target: esnext
// @filename: input.js
class C {
	constructor(/** @public */ y) {
	}
}

Expected behavior:

The emit should be be the following:

class C {
    constructor(/** @public */ y) {
    }
}

Actual behavior:

The emit includes a this property assignment as if the above declaration was a TypeScript parameter property:

class C {
    constructor(/** @public */ y) {
        this.y = y;
    }
}

Playground Link: NOTE: Cannot repro in the playground as the playground does not support JS output when using JS as the input language

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions