Skip to content

End-to-End types between Go and TypeScript

TODO description of generating TypeScript Definitions from using MkUnion

example/my-app/server.go
// this command make sure that all types that are imported will have generated typescript mapping
//go:generate ../../cmd/mkunion/mkunion shape-export --language=typescript -o ./src/workflow

// this lines defines all types that should have typescript mapping generated by above command
type (
    Workflow       = workflow.Workflow
    State          = workflow.State
    Command        = workflow.Command
    Expr           = workflow.Expr
    Predicate      = workflow.Predicate
    Reshaper       = workflow.Reshaper
    Schema         = schema.Schema
    UpdateRecords  = schemaless.UpdateRecords[schemaless.Record[any]]
    FindRecords    = schemaless.FindingRecords[schemaless.Record[any]]
    PageResult     = schemaless.PageResult[schemaless.Record[any]]
    FunctionOutput = workflow.FunctionOutput
    FunctionInput  = workflow.FunctionInput
)

//go:tag mkunion:"ChatCMD"
type (
    UserMessage struct {