-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix re-exported defaults in ExportInfoMap #58837
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @module: preserve | ||
// @checkJs: true | ||
|
||
// @Filename: /node_modules/example/package.json | ||
//// { "name": "example", "version": "1.0.0", "main": "dist/index.js" } | ||
|
||
// @Filename: /node_modules/example/dist/nested/module.d.ts | ||
//// declare const defaultExport: () => void; | ||
//// declare const namedExport: () => void; | ||
//// | ||
//// export default defaultExport; | ||
//// export { namedExport }; | ||
|
||
// @Filename: /node_modules/example/dist/index.d.ts | ||
//// export { default, namedExport } from "./nested/module"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ExportInfoMap stores chains of re-exports of a given symbol for as long as the symbol has “the same name” in every link in the chain. And by “name,” we mean ones that the user would want to reference a symbol by, not |
||
|
||
// @Filename: /index.mjs | ||
//// import { namedExport } from "example"; | ||
//// defaultExp/**/ | ||
|
||
verify.completions({ | ||
marker: "", | ||
exact: completion.globalsInJsPlus([ | ||
"namedExport", | ||
{ | ||
name: "defaultExport", | ||
source: "example", | ||
sourceDisplay: "example", | ||
hasAction: true, | ||
sortText: completion.SortText.AutoImportSuggestions | ||
}, | ||
]), | ||
preferences: { | ||
includeCompletionsForModuleExports: true, | ||
allowIncompleteCompletions: true, | ||
}, | ||
}); |
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 was being filtered out by the
!(symbol.flags & SymbolFlags.Transient)
condition in utilities.ts that I removed here. That code path was no longer exercised by the name generation code in the ExportInfoMap construction, but I was curious why it was there, and traced it back to andrewbranch@258be21 to see if it was going to be a problem. So much has changed around this in the last three years that it seems like the crash is no longer an issue, so I removed the transient symbol filtering from the other function where it was happening.