-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
71 lines (58 loc) · 1.33 KB
/
types.ts
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
export type MemberType = "method" | "property" | "constructor" | "constructor-sig" | "index-sig" | "call-sig" | "generic";
export type AnonymousMember = {
type?: Type,
question: boolean,
modifiers: string[]
}
export type IndexSig = AnonymousMember & {
member: Extract<MemberType, "index-sig">
}
export type NamedMember = AnonymousMember & {
name: string,
member: Exclude<MemberType, "constructor" | "constructor-sig" | "index-sig">
}
export type CallableMember = AnonymousMember & {
name?: string,
params: Param[],
typeParams?: string[],
member: Exclude<MemberType, "property" | "index-sig">
}
export type Member = CallableMember | NamedMember | IndexSig;
export type Modifier = "static"
| "public"
| "private"
| "protected"
| "readonly"
| "export"
| "default"
| "const"
| "async"
| "declare";
export type Param = {
name: string,
question: boolean,
modifiers?: Modifier[],
type: Type
}
type Callable = {
name?: string,
parameters: Param[],
modifiers?: Modifier[],
typeParams?: string[],
type: Type,
kind: "callable";
}
type Floor = string;
type Compound = {
members: Type[],
kind: "union" | "intersection"
}
type Array = {
members: Type,
kind: "array"
}
type Literal = {
members: Member[],
kind: "literal"
}
export type Type = Callable | Floor | Compound | Array | Literal;