Argument type Union[T, List[T]]
fails to infer constaints
#11149
Labels
Union[T, List[T]]
fails to infer constaints
#11149
While working on #11128 I got hit by this.
This code does not type check:
Which is not what I expect. For example, TypeScript solves this properly:
Link: https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABABwE5ynAthgpgGRgGcoAeAFQD4AKGMZEKALkXMQB9WBtAXQEoW5XogDeAWABQiaYlS4oIVEl6SAvpMmhIsBIii4SteoxZgQWAEa5UvPqPUTJ+w2gzY8hQwEY+fSUA
Cause
It happens somewhere here:
mypy/mypy/constraints.py
Lines 168 to 171 in b3ff2a6
I will try to solve this, but I know that this is going to be complicated.
The text was updated successfully, but these errors were encountered: