Skip to content

Fix forEachChild jsdoc @typedef tag #18333

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
Sep 8, 2017
Merged

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Sep 7, 2017

  1. Remove JSDocTypeLiteral.jsdocTypeTag, which made no sense since it was only useful when storing information for its parent @typedef tag.
  2. Also only visit jsdocPropertyTags if they exist, to mirror the behaviour of visitNodes.

Fixes #18301

Also remove JSDocTypeLiteral.jsdocTypeTag, which made no sense since it
was only useful when storing information for its parent `@typedef` tag.
@sandersn sandersn requested review from a user and weswigham September 7, 2017 23:40
@@ -6698,7 +6699,8 @@ namespace ts {
if (typeExpression && typeExpression.type.kind === SyntaxKind.ArrayType) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = finishNode(jsdocTypeLiteral);
const useChildTypeTagAsType = childTypeTag && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type);
typedefTag.typeExpression = useChildTypeTagAsType ? childTypeTag.typeExpression : finishNode(jsdocTypeLiteral);
Copy link

Choose a reason for hiding this comment

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

Probably better to make these one expression so that if we have strictNullChecks TS can infer that we just checked for childTypeTag being defined.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Done.

@sandersn sandersn merged commit d4e3e19 into master Sep 8, 2017
@sandersn sandersn deleted the fix-forEachChild-JSDocTypedefTag branch September 8, 2017 15:54
@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.

2 participants