- go2ts is a TypeScript interface generator from Go struct.
- Automatically recognize the Go module in the directory
$ go get github.com/go-generalize/go2ts
// ./example/main.go
package main
import (
"time"
)
type Status string
const (
StatusOK Status = "OK"
StatusFailure Status = "Failure"
)
type Param struct {
Status Status
Version int
Action string
CreatedAt time.Time
}
$ go2ts ./example
export type Param = {
Action: string;
CreatedAt: string;
Status: "Failure" | "OK";
Version: number;
}
- #18: enums in indirectly parsed packages are not recognized.
- Handle MarshalJSON/UnmarshalJSON