Skip to content

Don't crash when return type jsdoc tag is malformed #6709

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

Merged
merged 4 commits into from
Feb 2, 2016

Conversation

RyanCavanaugh
Copy link
Member

Fixes #6662

@@ -10344,7 +10344,7 @@ namespace ts {

function getReturnTypeFromJSDocComment(func: SignatureDeclaration | FunctionDeclaration): Type {
const returnTag = getJSDocReturnTag(func);
if (returnTag) {
if (returnTag && returnTag.typeExpression) {
return getTypeFromTypeNode(returnTag.typeExpression.type);
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you explicitly return undefined?

Copy link
Member

Choose a reason for hiding this comment

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

Or should you be returning the unknownType instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

undefined is fine.

//// x - /**/a1()

goTo.marker();
verify.quickInfoExists();
Copy link
Member

Choose a reason for hiding this comment

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

Can we also verify that the quickinfo still correctly contains the first line of the comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Verified manually since Fourslash is currently really bad at that

@billti
Copy link
Member

billti commented Feb 1, 2016

Couple of minor comments, else 👍

@mhegazy
Copy link
Contributor

mhegazy commented Feb 1, 2016

👍

RyanCavanaugh added a commit that referenced this pull request Feb 2, 2016
Don't crash when return type jsdoc tag is malformed
@RyanCavanaugh RyanCavanaugh merged commit bd3e9f2 into microsoft:master Feb 2, 2016
@RyanCavanaugh RyanCavanaugh deleted the fix6662 branch February 2, 2016 21:40
@billti billti mentioned this pull request Feb 4, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

5 participants