Skip to content

[Master] Take into account optional property in parameter #16070

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
May 26, 2017
Merged

Conversation

yuit
Copy link
Contributor

@yuit yuit commented May 24, 2017

Fix #15916

  • Add tests

@@ -2178,7 +2178,11 @@ namespace ts {
case SyntaxKind.JSDocRecordMember:
return bindPropertyWorker(node as JSDocRecordMember);
case SyntaxKind.JSDocPropertyTag:
return declareSymbolAndAddToSymbolTable(node as JSDocPropertyTag, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
let optionalType = 0;
if ((node as JSDocPropertyTag).typeExpression.type.kind === SyntaxKind.JSDocOptionalType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

typeExpression could be undefined.

Copy link
Contributor

Choose a reason for hiding this comment

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

consider inlinng this as:

function bindJSDocPropertyTag(node: JSDocPropertyTag) {
    return declareSymbolAndAddToSymbolTable(node, node.typeExpression && node.typeExpression.type.kind === SyntaxKind.JSDocOptionalType? SymbolFlags.Property | SymbolFalgs.Optionl : SymbolFlags.Property, SymbolFlags.PropertyExcludes);
}

@yuit yuit merged commit 068256b into master May 26, 2017
@yuit yuit deleted the master-15916 branch May 26, 2017 05:05
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 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.

3 participants