coder/scripts/apitypings
Kyle Carberry b0fe9bcdd1
chore: Upgrade to Go 1.19 (#3617)
This is required as part of #3505.
2022-08-21 22:32:53 +00:00
..
README.md chore: switch to generated types (#1394) 2022-05-12 10:01:28 -05:00
main.go chore: Upgrade to Go 1.19 (#3617) 2022-08-21 22:32:53 +00:00

README.md

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