Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tsc/internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -26666,9 +26666,16 @@ func (c *Checker) getUnionTypeWorker(types []*Type, unionReduction UnionReductio
}
if origin == nil && includes&TypeFlagsUnion != 0 {
namedUnions := c.addNamedUnions(nil, types)
// CompareTypes only returns 0 for identical types, so membership is a pointer lookup.
var namedTypes collections.Set[*Type]
for _, u := range namedUnions {
for _, t := range u.Types() {
namedTypes.Add(t)
Comment on lines +26671 to +26673

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, no? We already did similar work above for typeSet

}
}
var reducedTypes []*Type
for _, t := range typeSet {
if !core.Some(namedUnions, func(u *Type) bool { return containsType(u.Types(), t) }) {
if !namedTypes.Has(t) {
reducedTypes = append(reducedTypes, t)
}
}
Expand Down
Loading