Use symbols of type aliases when emitting declarations (#56087)

This commit is contained in:
Mateusz Burzyński
2024-01-09 13:02:52 -08:00
committed by GitHub
parent 4557e34e70
commit 4bcbc16cff
5 changed files with 172 additions and 0 deletions
+6
View File
@@ -5719,6 +5719,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
* 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;
}