Skip to content

Bind a jsdoc enum as SymbolFlags.TypeAlias and not SymbolFlags.Enum - #32520

Merged
Wesley Wigham (weswigham) merged 4 commits into
microsoft:masterfrom
weswigham:use-typealias-for-jsdoc-enum
Jul 26, 2019
Merged

Bind a jsdoc enum as SymbolFlags.TypeAlias and not SymbolFlags.Enum#32520
Wesley Wigham (weswigham) merged 4 commits into
microsoft:masterfrom
weswigham:use-typealias-for-jsdoc-enum

Conversation

@weswigham

Copy link
Copy Markdown
Member

Fixes #32413

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.

🎉

Comment thread src/harness/typeWriter.ts
// Don't try to get the type of something that's already a type.
// Exception for `T` in `type T = something` because that may evaluate to some interesting type.
if (ts.isPartOfTypeNode(node) || ts.isIdentifier(node) && !(ts.getMeaningFromDeclaration(node.parent) & ts.SemanticMeaning.Value) && !(ts.isTypeAlias(node.parent) && node.parent.name === node)) {
if (ts.isPartOfTypeNode(node) || ts.isIdentifier(node) && !(ts.getMeaningFromDeclaration(node.parent) & ts.SemanticMeaning.Value) && !(ts.isTypeAliasDeclaration(node.parent) && node.parent.name === node)) {

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.

Let me see if I can summarise what this means: we now bail for @callback, @typedef and @enum and some (which?) type aliases. Before it looks like there was a check that @callback and @typedef would usually fail, but sometimes incorrectly pass. But I'm not sure in what circumstances.

@weswigham Wesley Wigham (weswigham) Jul 26, 2019

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

getMeaningFromDeclaration on a JSDoc (as is the parent of all of these) isn't handled afaik, so those cases are already unreachable, as it's defaulted to All.

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.

Use SymbolFlags.TypeAlias when binding a jsdoc enum instead of SymbolFlags.Enum

2 participants