coder/scripts/apitypings
Kyle Carberry 546a8931aa
chore: move vscode local out of experiments (#5773)
We've been dogfooding the VS Code extension for a while,
and it seems stable enough that it's overall positive
to release!
2023-01-20 04:32:59 +00:00
..
testdata feat: add --experiments flag to replace --experimental (#5767) 2023-01-18 19:12:53 +00:00
README.md chore: Improve project-wide prettier formatting and ignored files (#5505) 2023-01-03 15:11:13 +02:00
main.go chore: move vscode local out of experiments (#5773) 2023-01-20 04:32:59 +00:00
main_test.go chore: Add generics to typescript generator (#4664) 2022-10-20 08:15:24 -05: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