-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix jsdoc typedef symbol scope + avoid bind twice if the type has a namespace prefix #14014
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
Conversation
src/compiler/binder.ts
Outdated
|
||
function bindJSDocTypedefTag(node: JSDocTypedefTag) { | ||
forEachChild(node, n => { | ||
// if the node has a fullName "A.B.C", that means symbol "C" was already bond |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:bound
src/compiler/binder.ts
Outdated
// if the node has a fullName "A.B.C", that means symbol "C" was already bound | ||
// when we visit "fullName"; so when we visit the name "C" as the next child of | ||
// the jsDocTypedefTag, we should skip binding it. | ||
if (n === node.name && node.fullName.kind !== SyntaxKind.Identifier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this bit implies that fullName
can be undefined. Is this case handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be an parsing error. If parsed correctly, fullName
should always has value. Will update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha I forgot the following case ...
/* @typedef { string | number } */
var NumberLike;
It can be undefined after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add this as a testcase?
@vladima further comments? |
Fixes #12233