Skip to content

Commit a6c0ff4

Browse files
committed
Fix erasing union types
1 parent 88127e0 commit a6c0ff4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/erasetype.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def visit_typeddict_type(self, t: TypedDictType) -> Type:
8282
return t.fallback.accept(self)
8383

8484
def visit_union_type(self, t: UnionType) -> Type:
85-
return AnyType() # XXX: return underlying type if only one?
85+
erased_items = [erase_type(item) for item in t.items]
86+
return UnionType.make_simplified_union(erased_items)
8687

8788
def visit_type_type(self, t: TypeType) -> Type:
8889
return TypeType(t.item.accept(self), line=t.line)

0 commit comments

Comments
 (0)