py2ts.generate¶
Functions
|
Convert a Python type to a TypeScript type. |
Module Functions
- py2ts.generate.generate_ts(py_type: Type | UnionType, config: MinimalConfig | None = None) TypescriptType¶
Convert a Python type to a TypeScript type.
This function is the main entry point for converting Python types to TypeScript types. It will recursively convert the type and its arguments to TypeScript types. The returned TypeScript type will be a tree of TypeScript types that represent the provided Python type.
- Parameters:
py_type (Type | UnionType) – The Python type to convert to a TypeScript type.
config (MinimalConfig, optional) – A dictionary with configuration options. If given, will reset all defaults!
- Returns:
The TypeScript type that corresponds to the provided Python type.
- Return type: