Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix visibility lookup for cjs require aliases#41257

Merged
weswigham merged 2 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
weswigham:jsdoc-declaration-emit-namesweswigham/TypeScript:jsdoc-declaration-emit-namesCopy head branch name to clipboard
Oct 27, 2020
Merged

Fix visibility lookup for cjs require aliases#41257
weswigham merged 2 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
weswigham:jsdoc-declaration-emit-namesweswigham/TypeScript:jsdoc-declaration-emit-namesCopy head branch name to clipboard

Conversation

@weswigham

Copy link
Copy Markdown
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
Comment thread src/compiler/checker.ts
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
Copy Markdown
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
Copy Markdown
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
@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.

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.