Skip to content
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

Fix visibility lookup for cjs require aliases #41257

Merged
merged 2 commits into from
Oct 27, 2020

Conversation

weswigham
Copy link
Member

Fixes the easier half of #41250 (painting the visibility of const {Item} = require("...") statements), which is otherwise still broken with this change. You can see how this change positively affects an existing baseline.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 26, 2020
else if (isBindingElement(declaration) && isInJSFile(declaration) && declaration.parent?.parent // exported import-like top-level JS require statement
&& isVariableDeclaration(declaration.parent.parent)
&& declaration.parent.parent.parent?.parent && isVariableStatement(declaration.parent.parent.parent.parent)
&& !hasSyntacticModifier(declaration.parent.parent.parent.parent, ModifierFlags.Export)
Copy link
Member

Choose a reason for hiding this comment

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

should we care about checking for const or require here? Probably doesn't matter because I don't think there are any other declarations that look like const { x } = require('y').

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe. Might just be worth checking for symbol.flags & SymbolFlags.Alias.

@weswigham weswigham merged commit aaa8b74 into microsoft:master Oct 27, 2020
@weswigham weswigham deleted the jsdoc-declaration-emit-names branch October 27, 2020 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants