Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFormatMappings = map[ir.IRFormat]generators.FormatTypeMapping{ ir.IRFormatByte: {Type: "string"}, ir.IRFormatDateTime: {Type: "Date"}, ir.IRFormatDate: {Type: "Date"}, ir.IRFormatUUID: {Type: "string"}, ir.IRFormatEmail: {Type: "string"}, ir.IRFormatURI: {Type: "string"}, }
DefaultFormatMappings provides sensible defaults for JSON Schema formats in TypeScript
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct{}
func (*Generator) Generate ¶
func (g *Generator) Generate(data *ir.IR, opts generators.GeneratorOptions, genOpts ...generators.GeneratorOption) ([]generators.GeneratedFile, error)
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option is a TypeScript-specific generator option
func WithBrandedTypes ¶
WithBrandedTypes enables branded types for primitive type aliases. This provides nominal typing for types like `type UserID = Branded<string, "UserID">` instead of just `type UserID = string`, preventing accidental mixing of ID types.
func WithExportTypes ¶
WithExportTypes sets whether to export all types
func WithFilename ¶
WithFilename sets the output filename (default: "types.ts")
func WithNullForOptional ¶
WithNullForOptional sets whether to use null instead of undefined for optional fields
func (Option) OptionValue ¶
OptionValue implements generators.GeneratorOption
Click to show internal directories.
Click to hide internal directories.