convert literal type to its variants

This commit is contained in:
Khaleel Al-Adhami 2024-10-04 13:36:18 -07:00
parent 9b5a36814a
commit f385f0e215

View File

@ -547,6 +547,10 @@ class Var(Generic[VAR_TYPE]):
return self
if fixed_type is Literal:
args = get_args(var_type)
fixed_type = unionize(*(type(arg) for arg in args))
if not inspect.isclass(fixed_type):
raise TypeError(f"Unsupported type {var_type} for guess_type.")