diff --git a/kitcom/internal/ts/tsparser.go b/kitcom/internal/ts/tsparser.go index b02ae12..5c94724 100644 --- a/kitcom/internal/ts/tsparser.go +++ b/kitcom/internal/ts/tsparser.go @@ -124,10 +124,10 @@ func (p *TypescriptApiParser) fieldToVal(typ *ast.TypeNode) (types.ValType, erro case "Buffer": return types.TBlob, nil 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: - 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) } } diff --git a/lib/golang/types/types.go b/lib/golang/types/types.go index 158f34c..d456c47 100644 --- a/lib/golang/types/types.go +++ b/lib/golang/types/types.go @@ -1,28 +1,12 @@ package types -type ValType int +type ValType string const ( - TInt ValType = 1 - TString ValType = 2 - TBool ValType = 3 - TBlob ValType = 4 - TArray ValType = 5 + TNoType ValType = "" // zero value constant for ValType (please don't use just "" as zero value!) + TInt ValType = "int" + TString ValType = "string" + TBool ValType = "bool" + 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") - } -}