TypeScript
Glue supports typescript as a code generation target.
Simply run:
shell
#Output modes
TypeScript generation supports:
- Types only (default): emits
export type ... - Zod mode: emits Zod schemas and inferred types
Enable Zod mode in .gluerc:
yaml
#Example
For this Glue spec:
glue
...generating TypeScript...
shell
...will produce code similar to:
ts
With typescript.zod: true, output is schema-first:
ts
#Notes
- Nested Glue models are emitted as flattened names (e.g.
Parent_Child). Record<K, V>is emitted asRecord<K, V>(orz.record(...)in Zod mode).- Anonymous model type atoms are currently not supported in TypeScript code generation.