Skip to content

Fix crash when looking for __esModule during symbol table merging #52554

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

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

andrewbranch
Copy link
Member

Fixes #48701

This is just more of #37964, but for our own lookups of __esModule. This function is literally only called with "__esModule" and InternalSymbolName.Default, so I can guarantee it doesn’t need to look at the global object type for those.

@andrewbranch andrewbranch marked this pull request as ready for review February 2, 2023 00:29
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 2, 2023
@@ -3882,7 +3882,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {

function resolveExportByName(moduleSymbol: Symbol, name: __String, sourceNode: TypeOnlyCompatibleAliasDeclaration | undefined, dontResolveAlias: boolean) {
const exportValue = moduleSymbol.exports!.get(InternalSymbolName.ExportEquals);
const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports!.get(name);
const exportSymbol = exportValue
Copy link
Member

Choose a reason for hiding this comment

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

May be adding a note or something just as a reminder would be good. (that its called for default or __esModule

@andrewbranch andrewbranch merged commit 4ec9b2f into microsoft:main Feb 2, 2023
@andrewbranch andrewbranch deleted the bug/48701 branch February 2, 2023 17:27
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
None yet
Development

Successfully merging this pull request may close these issues.

TS language service keeps crashing
3 participants