Skip to content

Commit

Permalink
Move the fix to getSymbolIfSameReference itself
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Nov 7, 2023
1 parent 672e797 commit 862603b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5665,19 +5665,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (getSymbolIfSameReference(exported, symbol)) {
return exported;
}
if (symbol.flags & SymbolFlags.TypeAlias && exported.declarations?.find(isTypeAlias)) {
const aliasSymbol = getDeclaredTypeOfTypeAlias(exported).aliasSymbol;
if (aliasSymbol && getSymbolIfSameReference(aliasSymbol, symbol)) {
return exported;
}
}
});
}

/**
* Checks if two symbols, through aliasing and/or merging, refer to the same thing
*/
function getSymbolIfSameReference(s1: Symbol, s2: Symbol) {
if (s1.flags & SymbolFlags.TypeAlias && s2.declarations?.find(isTypeAlias)) {
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
}
if (s2.flags & SymbolFlags.TypeAlias && s1.declarations?.find(isTypeAlias)) {
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
}
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
return s1;
}
Expand Down

0 comments on commit 862603b

Please sign in to comment.