coder/scripts/apitypings
Cian Johnston 407e61ecd4
feat(cli): support bundle: dump healthcheck summary (#12963)
* refactor(codersdk): extract common fields from HealthReport and friends
* feat(codersdk/healthsdk): add Summarize() method
* feat(cli): support bundle: dump healthcheck summary
2024-04-16 13:31:56 +01:00
..
testdata chore: update generated array type definitions in TypeScript to be readonly (#12947) 2024-04-15 09:46:10 -04:00
README.md chore: Improve project-wide prettier formatting and ignored files (#5505) 2023-01-03 15:11:13 +02:00
main.go feat(cli): support bundle: dump healthcheck summary (#12963) 2024-04-16 13:31:56 +01:00
main_test.go chore: update generated array type definitions in TypeScript to be readonly (#12947) 2024-04-15 09:46:10 -04: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