typescript

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 6 Imported by: 0

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

type Option

type Option struct {
	// contains filtered or unexported fields
}

Option is a TypeScript-specific generator option

func WithBrandedTypes

func WithBrandedTypes(enabled bool) Option

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

func WithExportTypes(export bool) Option

WithExportTypes sets whether to export all types

func WithFilename

func WithFilename(name string) Option

WithFilename sets the output filename (default: "types.ts")

func WithNullForOptional

func WithNullForOptional(useNull bool) Option

WithNullForOptional sets whether to use null instead of undefined for optional fields

func (Option) OptionValue

func (Option) OptionValue() string

OptionValue implements generators.GeneratorOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL