File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -7435,6 +7435,12 @@ namespace ts {
7435
7435
type = <UnionType>createType(TypeFlags.Union | propagatedFlags);
7436
7436
unionTypes.set(id, type);
7437
7437
type.types = types;
7438
+ /*
7439
+ Note: This is the alias symbol (or lack thereof) that we see when we first encounter this union type.
7440
+ For aliases of identical unions, eg `type T = A | B; type U = A | B`, the symbol of the first alias encountered is the aliasSymbol.
7441
+ (In the language service, the order may depend on the order in which a user takes actions, such as hovering over symbols.)
7442
+ It's important that we create equivalent union types only once, so that's an unfortunate side effect.
7443
+ */
7438
7444
type.aliasSymbol = aliasSymbol;
7439
7445
type.aliasTypeArguments = aliasTypeArguments;
7440
7446
}
@@ -7528,7 +7534,7 @@ namespace ts {
7528
7534
type = <IntersectionType>createType(TypeFlags.Intersection | propagatedFlags);
7529
7535
intersectionTypes.set(id, type);
7530
7536
type.types = typeSet;
7531
- type.aliasSymbol = aliasSymbol;
7537
+ type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
7532
7538
type.aliasTypeArguments = aliasTypeArguments;
7533
7539
}
7534
7540
return type;
You can’t perform that action at this time.
0 commit comments