Check type variable values [type-var]
Mypy checks that value of a type variable is compatible with a valuerestriction or the upper bound type.
Example:
- from typing import TypeVar
- T1 = TypeVar('T1', int, float)
- def add(x: T1, y: T1) -> T1:
- return x + y
- add(4, 5.5) # OK
- # Error: Value of type variable "T1" of "add" cannot be "str" [type-var]
- add('x', 'y')