Skip to content

Visit children of jsdoc type aliases in the binder #45312

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 5 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1666,11 +1666,15 @@ namespace ts {
}

function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag | JSDocEnumTag) {
setParent(node.tagName, node);
bind(node.tagName);
if (node.kind !== SyntaxKind.JSDocEnumTag && node.fullName) {
// don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag
setParent(node.fullName, node);
setParentRecursive(node.fullName, /*incremental*/ false);
}
if (typeof node.comment !== "string") {
bindEach(node.comment);
}
}

function bindJSDocClassTag(node: JSDocClassTag) {
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ namespace ts {
visitNode(cbNode, (node as JSDocTypedefTag).fullName) ||
(typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocComment> | undefined))
: visitNode(cbNode, (node as JSDocTypedefTag).fullName) ||
visitNode(cbNode, (node as JSDocTypedefTag).typeExpression)) ||
(typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocComment> | undefined));
visitNode(cbNode, (node as JSDocTypedefTag).typeExpression) ||
(typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocComment> | undefined)));
case SyntaxKind.JSDocCallbackTag:
return visitNode(cbNode, (node as JSDocTag).tagName) ||
visitNode(cbNode, (node as JSDocCallbackTag).fullName) ||
Expand Down
105 changes: 105 additions & 0 deletions tests/baselines/reference/quickInfoLink2.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoLink2.js",
"position": 39,
"name": ""
},
"quickInfo": {
"kind": "type",
"kindModifiers": "",
"textSpan": {
"start": 16,
"length": 23
},
"displayParts": [
{
"text": "type",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "AdditionalWallabyConfig",
"kind": "aliasName"
},
{
"text": " ",
"kind": "space"
},
{
"text": "=",
"kind": "operator"
},
{
"text": " ",
"kind": "space"
},
{
"text": "{",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "autoDetect",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "boolean",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
}
],
"documentation": [
{
"text": "Additional valid Wallaby config properties\nthat aren't defined in ",
"kind": "text"
},
{
"text": "{@link ",
"kind": "link"
},
{
"text": "IWallabyConfig ",
"kind": "linkText"
},
{
"text": "}",
"kind": "link"
},
{
"text": ".",
"kind": "text"
}
]
}
}
]
12 changes: 12 additions & 0 deletions tests/cases/fourslash/quickInfoLink2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
///<reference path="fourslash.ts" />

// @checkJs: true
// @Filename: quickInfoLink2.js
//// /**
//// * @typedef AdditionalWallabyConfig/**/ Additional valid Wallaby config properties
//// * that aren't defined in {@link IWallabyConfig}.
//// * @property {boolean} autoDetect
//// */

verify.noErrors()
verify.baselineQuickInfo();