-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtypescript.go
More file actions
49 lines (43 loc) · 1.29 KB
/
typescript.go
File metadata and controls
49 lines (43 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package bel
// TypescriptKind is the kind of a Typescript type (akin to the kind of Go types)
type TypescriptKind string
const (
// TypescriptSimpleKind means the type is merely a symbol
TypescriptSimpleKind TypescriptKind = "simple"
// TypescriptArrayKind means the type is an array
TypescriptArrayKind TypescriptKind = "array"
// TypescriptMapKind means the type is a map/dict
TypescriptMapKind TypescriptKind = "map"
// TypescriptInterfaceKind means the type is an interface
TypescriptInterfaceKind TypescriptKind = "iface"
// TypescriptEnumKind means the type is an enum
TypescriptEnumKind TypescriptKind = "enum"
)
// TypescriptType describes a type in the Typescript world
type TypescriptType struct {
Name string
Comment string
Kind TypescriptKind
Members []TypescriptMember
Params []TypescriptType
EnumMembers []TypescriptEnumMember
}
// TypescriptMember is a member of a Typescript interface
type TypescriptMember struct {
TypedElement
Comment string
IsOptional bool
IsFunction bool
Args []TypedElement
}
// TypescriptEnumMember is a member of a Typescript enum
type TypescriptEnumMember struct {
Name string
Value string
Comment string
}
// TypedElement pairs a name with a type
type TypedElement struct {
Name string
Type TypescriptType
}