1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare type Node = Document | Namespace | Class | Interface | Mixin | Function | Method | Type | ParamType | Property;
|
12 | export declare class Document {
|
13 | readonly kind: string;
|
14 | path: string;
|
15 | members: Array<Namespace | Class | Interface | Mixin | Function>;
|
16 | referencePaths: Set<string>;
|
17 | header: string;
|
18 | constructor(data: {
|
19 | path: string;
|
20 | members?: Array<Namespace | Class | Interface | Mixin | Function>;
|
21 | referencePaths?: Iterable<string>;
|
22 | header?: string;
|
23 | });
|
24 | /**
|
25 | * Iterate over all nodes in the document, depth first. Includes all
|
26 | * recursive ancestors, and the document itself.
|
27 | */
|
28 | traverse(): Iterable<Node>;
|
29 | /**
|
30 | * Clean up this AST.
|
31 | */
|
32 | simplify(): void;
|
33 | serialize(): string;
|
34 | }
|
35 | export declare class Namespace {
|
36 | readonly kind: string;
|
37 | name: string;
|
38 | description: string;
|
39 | members: Array<Namespace | Class | Interface | Mixin | Function>;
|
40 | constructor(data: {
|
41 | name: string;
|
42 | description?: string;
|
43 | members?: Array<Namespace | Class | Interface | Mixin | Function>;
|
44 | });
|
45 | traverse(): Iterable<Node>;
|
46 | serialize(depth?: number): string;
|
47 | }
|
48 | export declare class Class {
|
49 | readonly kind: string;
|
50 | name: string;
|
51 | description: string;
|
52 | extends: string;
|
53 | mixins: string[];
|
54 | properties: Property[];
|
55 | methods: Method[];
|
56 | constructor(data: {
|
57 | name: string;
|
58 | description?: string;
|
59 | extends?: string;
|
60 | mixins?: string[];
|
61 | properties?: Property[];
|
62 | methods?: Method[];
|
63 | });
|
64 | traverse(): Iterable<Node>;
|
65 | serialize(depth?: number): string;
|
66 | }
|
67 | export declare class Interface {
|
68 | readonly kind: string;
|
69 | name: string;
|
70 | description: string;
|
71 | extends: string[];
|
72 | properties: Property[];
|
73 | methods: Method[];
|
74 | constructor(data: {
|
75 | name: string;
|
76 | description?: string;
|
77 | extends?: string[];
|
78 | properties?: Property[];
|
79 | methods?: Method[];
|
80 | });
|
81 | traverse(): Iterable<Node>;
|
82 | serialize(depth?: number): string;
|
83 | }
|
84 | export declare class Mixin {
|
85 | readonly kind: string;
|
86 | name: string;
|
87 | description: string;
|
88 | interfaces: string[];
|
89 | constructor(data: {
|
90 | name: string;
|
91 | description?: string;
|
92 | interfaces?: string[];
|
93 | });
|
94 | traverse(): Iterable<Node>;
|
95 | serialize(depth?: number): string;
|
96 | }
|
97 | export declare abstract class FunctionLike {
|
98 | kind: string;
|
99 | name: string;
|
100 | description: string;
|
101 | params: Param[];
|
102 | templateTypes: string[];
|
103 | returns: Type;
|
104 | returnsDescription: string;
|
105 | constructor(data: {
|
106 | name: string;
|
107 | description?: string;
|
108 | params?: Param[];
|
109 | templateTypes?: string[];
|
110 | returns?: Type;
|
111 | returnsDescription?: string;
|
112 | });
|
113 | serialize(depth?: number): string;
|
114 | }
|
115 | export declare class Function extends FunctionLike {
|
116 | readonly kind: string;
|
117 | traverse(): Iterable<Node>;
|
118 | }
|
119 | export declare class Method extends FunctionLike {
|
120 | readonly kind: string;
|
121 | traverse(): Iterable<Node>;
|
122 | }
|
123 | export declare class Property {
|
124 | readonly kind: string;
|
125 | name: string;
|
126 | description: string;
|
127 | type: Type;
|
128 | constructor(data: {
|
129 | name: string;
|
130 | description?: string;
|
131 | type?: Type;
|
132 | });
|
133 | traverse(): Iterable<Node>;
|
134 | serialize(depth?: number): string;
|
135 | }
|
136 | export declare class Param {
|
137 | readonly kind: string;
|
138 | name: string;
|
139 | type: Type;
|
140 | optional: boolean;
|
141 | rest: boolean;
|
142 | description: string;
|
143 | constructor(data: {
|
144 | name: string;
|
145 | type: Type;
|
146 | optional?: boolean;
|
147 | rest?: boolean;
|
148 | description?: string;
|
149 | });
|
150 | traverse(): Iterable<Node>;
|
151 | serialize(): string;
|
152 | }
|
153 | export declare type Type = NameType | UnionType | ArrayType | FunctionType | ConstructorType | RecordType;
|
154 | export declare class NameType {
|
155 | readonly kind: string;
|
156 | name: string;
|
157 | constructor(name: string);
|
158 | traverse(): Iterable<Node>;
|
159 | serialize(): string;
|
160 | }
|
161 | export declare class UnionType {
|
162 | readonly kind: string;
|
163 | members: Type[];
|
164 | constructor(members: Type[]);
|
165 | traverse(): Iterable<Node>;
|
166 | /**
|
167 | * Simplify this union type:
|
168 | *
|
169 | * 1) Flatten nested unions (`foo|(bar|baz)` -> `foo|bar|baz`).
|
170 | * 2) De-duplicate identical members (`foo|bar|foo` -> `foo|bar`).
|
171 | */
|
172 | simplify(): void;
|
173 | serialize(): string;
|
174 | }
|
175 | export declare class ArrayType {
|
176 | readonly kind: string;
|
177 | itemType: Type;
|
178 | constructor(itemType: Type);
|
179 | traverse(): Iterable<Node>;
|
180 | serialize(): string;
|
181 | }
|
182 | export declare class FunctionType {
|
183 | readonly kind: string;
|
184 | params: ParamType[];
|
185 | returns: Type;
|
186 | constructor(params: ParamType[], returns: Type);
|
187 | traverse(): Iterable<Node>;
|
188 | serialize(): string;
|
189 | }
|
190 | export declare class ConstructorType {
|
191 | readonly kind: string;
|
192 | params: ParamType[];
|
193 | returns: NameType;
|
194 | constructor(params: ParamType[], returns: NameType);
|
195 | traverse(): Iterable<Node>;
|
196 | serialize(): string;
|
197 | }
|
198 | export declare class ParamType {
|
199 | readonly kind: string;
|
200 | name: string;
|
201 | type: Type;
|
202 | optional: boolean;
|
203 | traverse(): Iterable<Node>;
|
204 | constructor(name: string, type: Type, optional?: boolean);
|
205 | serialize(): string;
|
206 | }
|
207 | export declare class RecordType {
|
208 | readonly kind: string;
|
209 | fields: ParamType[];
|
210 | constructor(fields: ParamType[]);
|
211 | traverse(): Iterable<Node>;
|
212 | serialize(): string;
|
213 | }
|
214 | export declare const anyType: NameType;
|
215 | export declare const nullType: NameType;
|
216 | export declare const undefinedType: NameType;
|