mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
* chore: Improve project-wide prettier formatting and ignored files * chore: `Run make fmt/prettier` * Fix gitignore for `.vscode` folder so that ! works * Add comment in `.prettierrc.yaml` to explain `.editorconfig` * Remove scripts/apidocgen/markdown-template/README.md * Use `yq` for processing prettierrc, update lib.sh dependency check * Add `yq` to Dockerfile and Nix
39 lines
681 B
Markdown
39 lines
681 B
Markdown
# APITypings
|
|
|
|
This main.go generates typescript types from the codersdk types in Go.
|
|
|
|
# Features
|
|
|
|
- Supports Go types
|
|
- [x] Basics (string/int/etc)
|
|
- [x] Maps
|
|
- [x] Slices
|
|
- [x] Enums
|
|
- [x] Pointers
|
|
- [ ] External Types (uses `any` atm)
|
|
- Some custom external types are hardcoded in (eg: time.Time)
|
|
|
|
## Type overrides
|
|
|
|
```golang
|
|
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.
|
|
|
|
```golang
|
|
// @typescript-ignore InternalType
|
|
type InternalType struct {
|
|
// ...
|
|
}
|
|
```
|
|
|
|
# Future Ideas
|
|
|
|
- Use a yaml config for overriding certain types
|