This commit is contained in:
Egor Aristov 2025-12-06 13:13:12 +03:00
parent 6e7565284e
commit 57e4b16afc
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F
2 changed files with 9 additions and 25 deletions

View File

@ -124,10 +124,10 @@ func (p *TypescriptApiParser) fieldToVal(typ *ast.TypeNode) (types.ValType, erro
case "Buffer": case "Buffer":
return types.TBlob, nil return types.TBlob, nil
default: default:
return 0, fmt.Errorf("reference type %s is not supported yet", ident.Text) return types.TNoType, fmt.Errorf("reference type %s is not supported yet", ident.Text)
} }
default: default:
return 0, fmt.Errorf("type %s is not supported yet", typ.Kind) return types.TNoType, fmt.Errorf("type %s is not supported yet", typ.Kind)
} }
} }

View File

@ -1,28 +1,12 @@
package types package types
type ValType int type ValType string
const ( const (
TInt ValType = 1 TNoType ValType = "" // zero value constant for ValType (please don't use just "" as zero value!)
TString ValType = 2 TInt ValType = "int"
TBool ValType = 3 TString ValType = "string"
TBlob ValType = 4 TBool ValType = "bool"
TArray ValType = 5 TBlob ValType = "blob"
TArray ValType = "array"
) )
func (v ValType) String() string {
switch v {
case TInt:
return "int"
case TString:
return "string"
case TBool:
return "bool"
case TBlob:
return "blob"
case TArray:
return "array"
default:
panic("unreachable code")
}
}