FWIW, the proposed handling of TypeForm in combination with Annotated[...]
is already defined to work that way, stripping out the metadata component:
count: int | str = -1
if ismatch(count, Annotated[int, ValueRange(1, float('inf'))]):
assert_type(count, int) # NOT: Annotated[int, ...]
else:
assert_type(count, int | str)
Sorry I didn’t understand this bit at all:
-
TypeForm[Generic[GenericArgs]]
isn’t valid syntax becauseGeneric[...]
isn’t a type expression (or an annotation expression for that matter). -
RE “typevariables can’t be bound to parameterized generics” I’d have to see an example to understand what you mean. And how is this limitation on type variables related to TypeForm?