Skip to content

Commit

Permalink
Use differing type aliases, per request
Browse files Browse the repository at this point in the history
  • Loading branch information
weswigham committed Aug 18, 2022
1 parent b341699 commit cf010b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -2812,7 +2812,7 @@ namespace ts {
}

const file = moduleSymbol.declarations?.find(isSourceFile);
const specifier = getModuleSpecifierForTypeOnlyCompatibleAliasDeclaration(node);
const specifier = getModuleSpecifierForImportOrExport(node);
if (!specifier) {
return exportDefaultSymbol;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cf010b5

Please sign in to comment.