Generate TypeScript (and other language) type definitions from Go structs.
# Generate types to stdout
qntx typegen
# Generate to files
qntx typegen --output types/generated/
# Generate specific packages
qntx typegen --packages pulse/async,server
make types # Generate types
make types-check # Verify types are up to date
json TagControls field naming and optionality:
type Job struct {
ID string `json:"id"` // Required field: "id"
Status string `json:"status,omitempty"` // Optional field: "status?"
Internal string `json:"-"` // Skipped
}
tstype TagOverride TypeScript type:
type Event struct {
Timestamp time.Time `json:"timestamp" tstype:"Date"`
Metadata any `json:"metadata" tstype:"Record<string, unknown>"`
}
Force optional:
Count int `json:"count" tstype:",optional"` // count?: number
readonly TagGenerate readonly fields:
type Config struct {
Version string `json:"version" readonly:""` // readonly version: string
}
server/types.go)json:"field_name"make typesimport { YourType } from '@/types/generated/typescript'Types out of date in CI?
make types locally and commit the changesImport not found?
types/generated/typescript/index.ts includes your typeWrong TypeScript type?
tstype tag to override: `tstype:"YourCustomType"`Python, Rust, and Dart generators planned for v1.0.0.