py2ts.data.TSInterface¶
- class py2ts.data.TSInterface(name: str, elements: Dict[str, TypescriptType | TSInterface | TSEnumType], inheritance: TSInterface | TSInterfaceRef | None = None, *, not_required: bool = False, comment: str | None = None)¶
Represents a TypeScript interface.
Attributes
commentinheritancenot_requirednameelementsMethods
__init__(name, elements[, inheritance, ...])exclude(exclude)Exclude fields from the enum type.
full_str()Return a string representation of the interface including nested interfaces and enums.
Get all TypeScript types required for the current type.
- __init__(name: str, elements: Dict[str, TypescriptType | TSInterface | TSEnumType], inheritance: TSInterface | TSInterfaceRef | None = None, *, not_required: bool = False, comment: str | None = None) None¶
- exclude(exclude: set[str]) TSInterface¶
Exclude fields from the enum type.
- full_str() str¶
Return a string representation of the interface including nested interfaces and enums.
- referenced_types() set[TypescriptType]¶
Get all TypeScript types required for the current type.
This method should gather all the necessary types and dependencies related to the current type, aiding in understanding and organizing generated code where multiple type inter-dependencies exist.