A VSCode extension for converting Go structs to TypeScript interfaces and vice versa. Helpful for simple JSON API design.
Also check go4lage.com.
- Adds JSON tags if missing in Go structs.
- Convert Go structs to TypeScript interfaces.
- Convert TypeScript interfaces to Go structs.
- Context menu integration for quick access
- Configurable context menu visibility
- Handles basic Go types and common struct tags
- Supports optional fields (
omitempty)
- Install the extension from the VSCode Marketplace (available soon)
- Reload VSCode
Or Download here: (https://workupload.com/file/TUcAcRxAyzq)[https://workupload.com/file/TUcAcRxAyzq]
- Select a Go struct or TypeScript interface in your editor
- Right-click and choose "Convert Struct ↔ Interface (Go ↔ TS)" from the context menu
- The converted code will replace the selected text
go4lagetool.convert: Convert Go struct ↔ TypeScript interface
go4lagetool.showContextMenu: Show/hide the convert option in the editor context menu (default: true)
| Go Type | TypeScript Type |
|---|---|
string |
string |
int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64 |
number |
bool |
boolean |
time.Time |
string |
[]T |
T[] |
*T |
T |
| TypeScript Type | Go Type |
|---|---|
string |
string |
number |
int |
boolean |
bool |
T[] |
[]T |
MIT License - see the LICENSE file for details.