Skip to content

getJSDocParameterTags: Always return defined result#22523

Merged
4 commits merged into
masterfrom
getJSDocParameterTags_defined
Mar 14, 2018
Merged

getJSDocParameterTags: Always return defined result#22523
4 commits merged into
masterfrom
getJSDocParameterTags_defined

Conversation

@ghost
Copy link
Copy Markdown

@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
Comment thread src/compiler/checker.ts Outdated
}
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
Copy Markdown
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