Skip to content

Commit 862603b

Browse files
committed
Move the fix to getSymbolIfSameReference itself
1 parent 672e797 commit 862603b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5665,19 +5665,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
56655665
if (getSymbolIfSameReference(exported, symbol)) {
56665666
return exported;
56675667
}
5668-
if (symbol.flags & SymbolFlags.TypeAlias && exported.declarations?.find(isTypeAlias)) {
5669-
const aliasSymbol = getDeclaredTypeOfTypeAlias(exported).aliasSymbol;
5670-
if (aliasSymbol && getSymbolIfSameReference(aliasSymbol, symbol)) {
5671-
return exported;
5672-
}
5673-
}
56745668
});
56755669
}
56765670

56775671
/**
56785672
* Checks if two symbols, through aliasing and/or merging, refer to the same thing
56795673
*/
56805674
function getSymbolIfSameReference(s1: Symbol, s2: Symbol) {
5675+
if (s1.flags & SymbolFlags.TypeAlias && s2.declarations?.find(isTypeAlias)) {
5676+
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
5677+
}
5678+
if (s2.flags & SymbolFlags.TypeAlias && s1.declarations?.find(isTypeAlias)) {
5679+
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
5680+
}
56815681
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
56825682
return s1;
56835683
}

0 commit comments

Comments
 (0)