Expand description
TypeScript type generation and collection.
This module handles:
- Collecting named types (structs and enums) from service definitions
- Generating TypeScript type definitions (interfaces, type unions)
- Converting Rust types to TypeScript type strings
Functions§
- collect_
named_ types - Collect all named types (structs and enums with a name) from a service. Returns a vector of (name, Shape) pairs in dependency order.
- generate_
named_ types - Generate TypeScript type definitions for all named types.
- is_
fully_ supported - Check if a type can be fully encoded/decoded. Channel types (Tx/Rx) are supported - they encode as channel IDs.
- ts_
field_ access - Generate TypeScript field access expression. Uses bracket notation for numeric field names (tuple fields), dot notation otherwise.
- ts_
scalar_ type - Convert ScalarType to TypeScript type string.
- ts_type
- TypeScript type for user-facing type definitions. Uses named types when available.
- ts_
type_ base_ named - Convert Shape to TypeScript type string, using named types when available. This handles container types recursively, using named types at every level.
- ts_
type_ client_ arg - Convert Shape to TypeScript type string for client arguments. Schema is from server’s perspective - no inversion needed. Client passes the same types that server receives.
- ts_
type_ client_ return - Convert Shape to TypeScript type string for client returns. Schema is from server’s perspective - no inversion needed.
- ts_
type_ server_ arg - Convert Shape to TypeScript type string for server/handler arguments. Schema is from server’s perspective - no inversion needed. Rx means server receives, Tx means server sends.
- ts_
type_ server_ return - Schema is from server’s perspective - no inversion needed.