Skip to content

Emit an any for namepath types#37176

Merged
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:emit-any-for-namepath
Mar 3, 2020
Merged

Emit an any for namepath types#37176
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:emit-any-for-namepath

Conversation

@weswigham
Copy link
Copy Markdown
Member

Fixes #36690

When we added an AST node to parse over namepaths in #32563, we didn't add any checker code to handle the new type node anywhere - in many cases, this meant a fallback to the errorType (which is fine), but here we needed to explicitly map the namepath type node into an any type node.

Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Fix makes sense here -- should we also add a general fallback to these specific early exit?

@weswigham
Copy link
Copy Markdown
Member Author

should we also add a general fallback to these specific early exit?

? what do you mean?

Copy link
Copy Markdown
Contributor

@orta orta left a comment

Choose a reason for hiding this comment

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

Thanks! Feels alright to me

@sandersn
Copy link
Copy Markdown
Member

sandersn commented Mar 3, 2020

Yikes, I mangled that sentence! What I meant was: the function has an early exit for specific cases. Should it also have a general fallback at the bottom sort of like we give errorType when type checking? (That's a question for future work anyway; the code as-is is good as a bug fix.)

@weswigham
Copy link
Copy Markdown
Member Author

Should it also have a general fallback at the bottom sort of like we give errorType when type checking?

It has a "fallback" already - emit the node as-is, which is used for most typenodes. We only map away jsdoc-y typenodes here, cause printing them in not jsdoc is probably wrong. Namepath is even more special in that it doesn't even have emitter code, so actually just printed as an empty string.

@weswigham weswigham merged commit 5941c6e into microsoft:master Mar 3, 2020
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JsDoc @type {modue:X} + null default value = syntactically invalid .d.ts emit

4 participants