Go Struct转TypeScript工具 | 智能在线生成TS接口定义 - GoTool在线工具集

开发工具指南

在线 Go Struct 转 TypeScript 工具,支持 JSON 标签、数组、map、嵌套结构体等类型转换,适合前后端协作与接口类型统一,立即在线使用,无需安装!

使用说明

🛠 功能简介

该工具可将 Go 语言中的 struct 结构体转换为 TypeScript 类型定义(interface 或 type),支持解析常见基础类型、数组、map、嵌套结构体、json 标签等。

✅ 支持的 Go 类型

Go 类型 TypeScript 类型
string string
int / int64 number
float32 / float64 number
bool boolean
[]T T[]
T T
other string

📝 使用示例

输入 Go 结构体:

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"`
}

输出 TypeScript 类型:

interface User {
  id: number;
  name: string;
  email: string;
  created_at: string;
  tags: string[];
}