Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments on PropertyDeclaration nodes not honored by the TS transform. #22497

Closed
alxhub opened this issue Mar 12, 2018 · 2 comments
Closed

Comments on PropertyDeclaration nodes not honored by the TS transform. #22497

alxhub opened this issue Mar 12, 2018 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@alxhub
Copy link

alxhub commented Mar 12, 2018

TypeScript Version: 2.7.2

Search Terms: PropertyDeclaration

Code

function addComment(property: ts.PropertyDeclaration): void {
  ts.addSyntheticLeadingComment(property, ts.SyntaxKind.MultiLevelCommentTrivia, 'this comment will never show up');
}

Expected behavior:

The comment appears in the generated JS file.

Actual behavior:

The comment is missing from the generated JS file.

Playground Link: n/a

Related Issues:

More Info:

The comment is dropped in the ts.ts transform function addInitializedPropertyStatements. As part of transforming the PropertyDeclaration nodes into Statements, their comments are forgotten:

https://github.com/Microsoft/TypeScript/blob/master/src/compiler/transformers/ts.ts#L1219

@j-oliveras
Copy link
Contributor

Duplicate of #17689 and #22377.

Probably solved by #22141. You can try it with a nightly build.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 13, 2018
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants