py2ts.data.TypescriptPrimitive¶
- class py2ts.data.TypescriptPrimitive(value)¶
Represents a TypeScript primitive type.
Attributes
STRINGNUMBERBOOLEANNULLUNDEFINEDUNKNOWNNEVERVOIDUINT8ARRAYDATEANYMethods
from_python_type(py_type)Convert a Python type to a corresponding TypeScript primitive type.
- classmethod from_python_type(py_type: type | UnionType) TypescriptPrimitive | None¶
Convert a Python type to a corresponding TypeScript primitive type.
- Parameters:
py_type (type) – The Python type to be converted.
- Returns:
The corresponding TypeScript primitive type, or None if no mapping exists.
- Return type:
TypescriptPrimitive | None