mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
* feat: Switch packages for typescript generation code Supports a larger set of types - [x] Basics (string/int/etc) - [x] Maps - [x] Slices - [x] Enums - [x] Pointers
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
- Should
omitempty
in thejson
tag indicate optional? - Use a yaml config for overriding certain types