GoTool provides an easy-to-use Go Struct to TypeScript tool that supports type conversions such as JSON tags, arrays, maps, and nested structures. It is suitable for front-end collaboration and unified interface types. It can be used online immediately without installation!
使用说明
🛠 Overview
This tool converts Go struct definitions into TypeScript interfaces or types. It supports basic types, arrays, maps, nested structs, and json tags.
✅ Supported Go Types
| Go Type | TypeScript Type |
|---|---|
string |
string |
int / int64 |
number |
float32 / float64 |
number |
bool |
boolean |
[]T |
T[] |
T |
T |
other |
string |
📝 Example
Input Go Struct:
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
Tags []string `json:"tags"`
}
Output TypeScript Interface:
interface User {
id: number;
name: string;
email: string;
created_at: string;
tags: string[];
}