TypeForm: Spelling for a type annotation object at runtime

The current status quo is that static type checkers generally strip out the metadata part of an Annotated[T, metadata] type, such as in the code below:

x: Annotated[int, '> 0']
reveal_type(x)  # mypy: Revealed type is "builtins.int"
assert_type(x, int)

(Eric explains why in the comment starting with “No, metadata cannot be preserved.” in this thread.)

The current TypeForm proposal attempts to align with this status quo rather than change it, because there is limited benefit to changing the status quo for the applications that TypeForm is intended for in its Motivation.

Future proposals could very well alter the handling of Annotated[T, metadata] to preserve metadata. Or even introduce something entirely separate altogether, such as some kind of Refinement[...] syntax. But that’s out of scope for TypeForm.