Skip to content

No comment preservation for parenthesized expressions #9873

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

Closed
DanielRosenwasser opened this issue Jul 21, 2016 · 3 comments · Fixed by #22141
Closed

No comment preservation for parenthesized expressions #9873

DanielRosenwasser opened this issue Jul 21, 2016 · 3 comments · Fixed by #22141
Labels
Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

@evmar ran into issues where generating a JSDoc comment for a type assertion for Closure did not get preserved.

Neither

var x = (/** @type {Foo.Bar} */ y);

nor

var x = /** @type {Foo.Bar} */ (y);

have their comments preserved, though I'm not sure which is more common.

@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Jul 21, 2016
@weswigham
Copy link
Member

weswigham commented Jul 21, 2016

@DanielRosenwasser

var x = /** @type {Foo.Bar} */y;

is also unpreserved. It's not unique to parenthesized expressions.

@mprobst
Copy link
Contributor

mprobst commented Nov 11, 2016

Also happens for dotted expressions:

let x = /** @type {string} */ foo.bar;

@olemartinorg
Copy link

Not sure if related, but it also happens for regular comments when they appear before a }:

// Comment
let a = 5;
// Another comment
if (a === 5) { 
    alert('hello world');
    // Third comment
}

Compiles to:

// Comment
var a = 5;
// Another comment
if (a === 5) {
    alert('hello world');
}

tbosch added a commit to tbosch/tsickle that referenced this issue Aug 1, 2017
when using a call expression.

E.g.
```
Polymer({behaviors: [(Polymer as any).NeonAnimationRunnerBehavior])
```

This type cast was never emitted in non transformer mode due to
microsoft/TypeScript#9873.

This is a temporary workaround, the real fix is to change
the Polymer Closure plugin (see angular#529).
tbosch added a commit to tbosch/tsickle that referenced this issue Aug 1, 2017
when using a call expression.

E.g.
```
Polymer({behaviors: [(Polymer as any).NeonAnimationRunnerBehavior])
```

This type cast was never emitted in non transformer mode due to
microsoft/TypeScript#9873.

This is a temporary workaround, the real fix is to change
the Polymer Closure plugin (see angular#529).
tbosch added a commit to tbosch/tsickle that referenced this issue Aug 1, 2017
when using a call expression.

E.g.
```
Polymer({behaviors: [(Polymer as any).NeonAnimationRunnerBehavior])
```

This type cast was never emitted in non transformer mode due to
microsoft/TypeScript#9873.

This is a temporary workaround, the real fix is to change
the Polymer Closure plugin (see angular#529).
tbosch added a commit to tbosch/tsickle that referenced this issue Aug 1, 2017
when using a call expression.

E.g.
```
Polymer({behaviors: [(Polymer as any).NeonAnimationRunnerBehavior])
```

This type cast was never emitted in non transformer mode due to
microsoft/TypeScript#9873.

This is a temporary workaround, the real fix is to change
the Polymer Closure plugin (see angular#529).
tbosch added a commit to angular/tsickle that referenced this issue Aug 1, 2017
when using a call expression.

E.g.
```
Polymer({behaviors: [(Polymer as any).NeonAnimationRunnerBehavior])
```

This type cast was never emitted in non transformer mode due to
microsoft/TypeScript#9873.

This is a temporary workaround, the real fix is to change
the Polymer Closure plugin (see #529).
@DanielRosenwasser DanielRosenwasser added the Domain: Comment Emit The issue relates to the emission of comments when compiling label Aug 3, 2017
@mhegazy mhegazy modified the milestones: Community, TypeScript 2.8 Mar 3, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Mar 3, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants