Skip to content

Conversation

jakebailey
Copy link
Member

Fixes #48008

default appears as an identifier in the AST, which appears to be expected. Just return undefined to skip the symbol rather than asserting that it's not legal.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 24, 2022

// "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
if (symbolName === InternalSymbolName.Default) {
return undefined;
Copy link

Choose a reason for hiding this comment

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

Suggested change
return undefined;
return;

Copy link
Member Author

Choose a reason for hiding this comment

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

While technically equivalent, I don't think an implicit undefined return is very clear (and this codebase doesn't really do this).

@jakebailey jakebailey changed the title Add failing test case Prevent crash on code fixes on default keyword Feb 25, 2022
@jakebailey jakebailey merged commit 4abad55 into microsoft:main Mar 4, 2022
@jakebailey jakebailey deleted the fix-48008 branch March 4, 2022 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Inappropriate assertion failure in 'getFixesInfoForNonUMDImport'
4 participants