Files
coder/scripts/apitypings
Steven Masley 6230d5512e chore: Remove line numbers from auto-gen typescript (#3258)
* chore: Remove line numbers from auto-gen typescript

The line numbers are just extra noise that change when things shift
around. They are not required and usually make CI fail when you
forget to run 'make gen'.
2022-07-27 21:36:15 +00:00
..

APITypings

This main.go generates typescript types from the codersdk types in Go.

Features

  • Supports Go types
    • Basics (string/int/etc)
    • Maps
    • Slices
    • Enums
    • Pointers
    • External Types (uses any atm)
      • Some custom external types are hardcoded in (eg: time.Time)

Type overrides

type Foo struct {
	// Force the typescript type to be a number
	CreatedAt time.Duration `json:"created_at" typescript:"number"`
}

Ignore Types

Do not generate ignored types.

// @typescript-ignore InternalType
type InternalType struct {
	// ...
}

Future Ideas

  • Use a yaml config for overriding certain types