convert literal type to its variants (#4062)
This commit is contained in:
parent
9b5a36814a
commit
12b81ad754
@ -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.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user