Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Mar 8, 2018

Fixes #22358

@ghost ghost requested review from amcasey and sandersn March 8, 2018 18:24
@ghost ghost merged commit a49e83f into master Mar 8, 2018
@ghost ghost deleted the jsdoctype_insertTypeAnnotation branch March 8, 2018 19:47
`class C {
/** @return {number} */
get c(): number { return 12; }
get c(): number { return 12 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we drop the semicolon?

Copy link
Author

@ghost ghost Mar 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no semicolon in the original (line 4 of this file). Previously we would reformat the body, but now we just add a type annotation.

return getJSDocType(node);
}
export function getEffectiveTypeAnnotationNode(node: Node): TypeNode | undefined {
return (node as HasType).type || (isInJavaScriptFile(node) ? getJSDocType(node) : undefined);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own understanding, if node is not a HasType but does have a type property with a defined value, we will return that (as we did before?)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the assumption is that only a HasType has a type.

@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants