mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Use symbols of type aliases when emitting declarations (#56087)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user