Skip to content

Fix completions crash on transient exported property named 'default'#42583

Merged
andrewbranch merged 2 commits intomicrosoft:masterfrom
andrewbranch:bug/40991
Feb 4, 2021
Merged

Fix completions crash on transient exported property named 'default'#42583
andrewbranch merged 2 commits intomicrosoft:masterfrom
andrewbranch:bug/40991

Conversation

@andrewbranch
Copy link
Copy Markdown
Member

Fixes #40991

Also includes a drive-by improvement to allow us to get a name for default or export= when the target is an identifier with parentheses, non-null assertions, type assertions, etc., instead of just a bare identifier.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 1, 2021
Copy link
Copy Markdown
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

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

These all seem like sensible changes, but it's not immediately obvious to me what was actually crashing. Maybe aliased.parent was undefined?

Comment thread tests/cases/fourslash/completionsImport_weirdDefaultSynthesis.ts
Comment thread src/services/codefixes/importFixes.ts
@andrewbranch
Copy link
Copy Markdown
Member Author

In this case default was an intersection property where the constituent properties had different parents. So on the intersection property, there is no parent, because it’s not clear why one parent would be favored over the other. A “real” default export should never be an intersection property, or transient at all (this was just manually named “default”), so there was no reason to treat it as an auto-importable export.

@andrewbranch andrewbranch merged commit 258be21 into microsoft:master Feb 4, 2021
@andrewbranch andrewbranch deleted the bug/40991 branch February 4, 2021 18:22
@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 Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

esModuleInterop:true breaks intellisense

3 participants