clan_cli: Add typeAlias support for api.py

This commit is contained in:
Qubasa
2025-10-14 11:30:48 +02:00
parent 2ef56aff70
commit f1747079c8

View File

@@ -13,6 +13,7 @@ from typing import (
NewType,
NotRequired,
Required,
TypeAliasType,
TypeVar,
Union,
get_args,
@@ -239,6 +240,12 @@ def type_to_dict(
origtype = t.__supertype__
return type_to_dict(origtype, scope, type_map)
if isinstance(t, TypeAliasType):
# Handle PEP 695 type aliases (type X = Y syntax)
return type_to_dict(
t.__value__, scope, type_map, narrow_unsupported_union_types
)
if hasattr(t, "__origin__"): # Check if it's a generic type
origin = get_origin(t)
args = get_args(t)