py2ts.data.TypescriptIntersectionType¶
- class py2ts.data.TypescriptIntersectionType(elements: Set[TypescriptType] | TypescriptType | Sequence[TypescriptType], *, not_required: bool = False, comment: str | None = None)¶
Represents a TypeScript intersection type.
Note: Not really used in the code generation process. But in theory, it could be used to represent the intersection of two types, similar to the union type.
Example: {“foo”:number} & {“bar”:string}
Attributes
commentnot_requiredelementsMethods
__init__(elements, *[, not_required, comment])Get all TypeScript types required for the current type.
- __init__(elements: Set[TypescriptType] | TypescriptType | Sequence[TypescriptType], *, not_required: bool = False, comment: str | None = None) None¶
- 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.