tkrajina / typescriptify-golang-structs

A Golang struct to TypeScript class/interface converter
Apache License 2.0
505 stars 87 forks source link

go 1.18 generics support #58

Open sev3ryn opened 2 years ago

sev3ryn commented 2 years ago

It would be great if this tool could convert Go generics to Typescript generics

type SimpleTile struct {
    AuditID string `json:"audit_id,omitempty"`
    Image   string `json:"image"`
}

type WideTile struct {
    SimpleTile
    Title      string `json:"title"`
    ButtonText string `json:"button_text"`
}

type DefaultTile struct {
    SimpleTile
    Title           string `json:"title"`
    ProviderName    string `json:"provider_name"`
    ProviderFavicon string `json:"provider_favicon"`
}

type Teaser[T DefaultTile | SimpleTile | WideTile] struct {
    Tiles []T `json:"tiles"`
}
johan-lejdung commented 1 year ago

Agreed, running into the same issue. Might solve it in out fork in a while