This commit is contained in:
Egor Aristov 2025-10-23 10:23:02 +03:00
parent 83854d36ad
commit f539c8bf59
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F

View File

@ -21,13 +21,13 @@ func (g *TypescriptApiGenerator) Generate(api *Api, destFile string) error {
Api: api, Api: api,
} }
tpl := template.New("gogen") tpl := template.New("tsgen")
tpl = tpl.Funcs(map[string]any{ tpl = tpl.Funcs(map[string]any{
"typedef": func(t ValType) (string, error) { "typedef": func(t ValType) (string, error) {
td, ok := map[ValType]string{ td, ok := map[ValType]string{
TInt: "number", TInt: "number",
TString: "string", TString: "string",
TBool: "bool", TBool: "boolean",
}[t] }[t]
if !ok { if !ok {
return "", fmt.Errorf("cannot generate type %v", t) return "", fmt.Errorf("cannot generate type %v", t)