Skip to content

getJSDocParameterTags: Always return defined result #22523

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
4 commits merged into from
Mar 14, 2018

Conversation

ghost
Copy link

@ghost ghost commented Mar 13, 2018

There's no semantic difference between [] and undefined here, so always returning [] cleans up a lot of undefined checks.
(Will conflict with #22514, I'll rebase)

@ghost ghost requested a review from sandersn March 13, 2018 22:41
}
return isInJavaScriptFile(node) && (
node.type && node.type.kind === SyntaxKind.JSDocOptionalType
|| some(getJSDocParameterTags(node), paramTag => paramTag.isBracketed || !!paramTag.typeExpression && paramTag.typeExpression.type.kind === SyntaxKind.JSDocOptionalType));
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 figure out a way to make this line shorter? probably just breaking it after the first argument to some would work.

@ghost ghost force-pushed the getJSDocParameterTags_defined branch from fc941a1 to 5ea6c28 Compare March 14, 2018 00:16
@ghost ghost merged commit d1d6960 into master Mar 14, 2018
@ghost ghost deleted the getJSDocParameterTags_defined branch March 14, 2018 00:56
@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