From cf010b517d22ad3745d7f0556743bb504a502910 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 18 Aug 2022 15:13:49 -0700 Subject: [PATCH] Use differing type aliases, per request --- src/compiler/checker.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5a325cfc0599b..8c8101e87374c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2802,7 +2802,7 @@ namespace ts { } } - function getTargetofModuleDefault(moduleSymbol: Symbol, node: TypeOnlyCompatibleAliasDeclaration, dontResolveAlias: boolean) { + function getTargetofModuleDefault(moduleSymbol: Symbol, node: ImportClause | ImportOrExportSpecifier, dontResolveAlias: boolean) { let exportDefaultSymbol: Symbol | undefined; if (isShorthandAmbientModuleSymbol(moduleSymbol)) { exportDefaultSymbol = moduleSymbol; @@ -2812,7 +2812,7 @@ namespace ts { } const file = moduleSymbol.declarations?.find(isSourceFile); - const specifier = getModuleSpecifierForTypeOnlyCompatibleAliasDeclaration(node); + const specifier = getModuleSpecifierForImportOrExport(node); if (!specifier) { return exportDefaultSymbol; } @@ -2850,7 +2850,7 @@ namespace ts { return exportDefaultSymbol; } - function getModuleSpecifierForTypeOnlyCompatibleAliasDeclaration(node: TypeOnlyCompatibleAliasDeclaration): Expression | undefined { + function getModuleSpecifierForImportOrExport(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportOrExportSpecifier): Expression | undefined { switch (node.kind) { case SyntaxKind.ImportClause: return node.parent.moduleSpecifier; case SyntaxKind.ImportEqualsDeclaration: return isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; @@ -3073,7 +3073,7 @@ namespace ts { function getTargetOfImportSpecifier(node: ImportSpecifier | BindingElement, dontResolveAlias: boolean): Symbol | undefined { if (isImportSpecifier(node) && idText(node.propertyName || node.name) === InternalSymbolName.Default) { - const specifier = getModuleSpecifierForTypeOnlyCompatibleAliasDeclaration(node); + const specifier = getModuleSpecifierForImportOrExport(node); const moduleSymbol = specifier && resolveExternalModuleName(node, specifier); if (moduleSymbol) { return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias); @@ -3104,7 +3104,7 @@ namespace ts { function getTargetOfExportSpecifier(node: ExportSpecifier, meaning: SymbolFlags, dontResolveAlias?: boolean) { if (idText(node.propertyName || node.name) === InternalSymbolName.Default) { - const specifier = getModuleSpecifierForTypeOnlyCompatibleAliasDeclaration(node); + const specifier = getModuleSpecifierForImportOrExport(node); const moduleSymbol = specifier && resolveExternalModuleName(node, specifier); if (moduleSymbol) { return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);