ast-types 0.11.5 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +2 -2
- package/def/babel-core.d.ts +2 -0
- package/def/babel-core.js +250 -290
- package/def/babel.d.ts +2 -0
- package/def/babel.js +12 -3
- package/def/core.d.ts +2 -0
- package/def/core.js +57 -126
- package/def/es-proposals.d.ts +2 -0
- package/def/es-proposals.js +34 -32
- package/def/es6.d.ts +2 -0
- package/def/es6.js +210 -253
- package/def/es7.d.ts +2 -0
- package/def/es7.js +35 -41
- package/def/esprima.d.ts +2 -0
- package/def/esprima.js +50 -71
- package/def/flow.d.ts +2 -0
- package/def/flow.js +289 -393
- package/def/jsx.d.ts +2 -0
- package/def/jsx.js +99 -125
- package/def/type-annotations.d.ts +7 -0
- package/def/type-annotations.js +42 -0
- package/def/typescript.d.ts +2 -0
- package/def/typescript.js +326 -444
- package/fork.d.ts +46 -0
- package/fork.js +40 -31
- package/gen/builders.d.ts +2539 -0
- package/gen/builders.js +2 -0
- package/gen/kinds.d.ts +259 -0
- package/gen/kinds.js +2 -0
- package/gen/namedTypes.d.ts +262 -0
- package/gen/namedTypes.js +2 -0
- package/gen/nodes.d.ts +1255 -0
- package/gen/nodes.js +2 -0
- package/gen/visitor.d.ts +263 -0
- package/gen/visitor.js +2 -0
- package/lib/equiv.d.ts +5 -0
- package/lib/equiv.js +19 -49
- package/lib/node-path.d.ts +22 -0
- package/lib/node-path.js +60 -125
- package/lib/path-visitor.d.ts +52 -0
- package/lib/path-visitor.js +117 -194
- package/lib/path.d.ts +25 -0
- package/lib/path.js +71 -107
- package/lib/scope.d.ts +26 -0
- package/lib/scope.js +100 -143
- package/lib/shared.d.ts +13 -0
- package/lib/shared.js +34 -31
- package/lib/types.d.ts +140 -0
- package/lib/types.js +584 -676
- package/main.d.ts +16 -0
- package/main.js +33 -18
- package/package.json +24 -7
- package/tsconfig.json +20 -0
- package/types.d.ts +6 -0
- package/types.js +2 -0
- package/def/e4x.js +0 -86
- package/def/mozilla.js +0 -42
package/def/flow.js
CHANGED
|
@@ -1,394 +1,290 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var types = fork.use(require("../lib/types"));
|
|
5
|
-
var def = types.Type.def;
|
|
6
|
-
var or = types.Type.or;
|
|
7
|
-
var defaults = fork.use(require("../lib/shared")).defaults;
|
|
8
|
-
|
|
9
|
-
// Base types
|
|
10
|
-
|
|
11
|
-
def("Flow").bases("Node");
|
|
12
|
-
def("FlowType").bases("Flow");
|
|
13
|
-
|
|
14
|
-
// Type annotations
|
|
15
|
-
|
|
16
|
-
def("AnyTypeAnnotation")
|
|
17
|
-
.bases("FlowType")
|
|
18
|
-
.build();
|
|
19
|
-
|
|
20
|
-
def("EmptyTypeAnnotation")
|
|
21
|
-
.bases("FlowType")
|
|
22
|
-
.build();
|
|
23
|
-
|
|
24
|
-
def("MixedTypeAnnotation")
|
|
25
|
-
.bases("FlowType")
|
|
26
|
-
.build();
|
|
27
|
-
|
|
28
|
-
def("VoidTypeAnnotation")
|
|
29
|
-
.bases("FlowType")
|
|
30
|
-
.build();
|
|
31
|
-
|
|
32
|
-
def("NumberTypeAnnotation")
|
|
33
|
-
.bases("FlowType")
|
|
34
|
-
.build();
|
|
35
|
-
|
|
36
|
-
def("NumberLiteralTypeAnnotation")
|
|
37
|
-
.bases("FlowType")
|
|
38
|
-
.build("value", "raw")
|
|
39
|
-
.field("value", Number)
|
|
40
|
-
.field("raw", String);
|
|
41
|
-
|
|
42
|
-
// Babylon 6 differs in AST from Flow
|
|
43
|
-
// same as NumberLiteralTypeAnnotation
|
|
44
|
-
def("NumericLiteralTypeAnnotation")
|
|
45
|
-
.bases("FlowType")
|
|
46
|
-
.build("value", "raw")
|
|
47
|
-
.field("value", Number)
|
|
48
|
-
.field("raw", String);
|
|
49
|
-
|
|
50
|
-
def("StringTypeAnnotation")
|
|
51
|
-
.bases("FlowType")
|
|
52
|
-
.build();
|
|
53
|
-
|
|
54
|
-
def("StringLiteralTypeAnnotation")
|
|
55
|
-
.bases("FlowType")
|
|
56
|
-
.build("value", "raw")
|
|
57
|
-
.field("value", String)
|
|
58
|
-
.field("raw", String);
|
|
59
|
-
|
|
60
|
-
def("BooleanTypeAnnotation")
|
|
61
|
-
.bases("FlowType")
|
|
62
|
-
.build();
|
|
63
|
-
|
|
64
|
-
def("BooleanLiteralTypeAnnotation")
|
|
65
|
-
.bases("FlowType")
|
|
66
|
-
.build("value", "raw")
|
|
67
|
-
.field("value", Boolean)
|
|
68
|
-
.field("raw", String);
|
|
69
|
-
|
|
70
|
-
def("TypeAnnotation")
|
|
71
|
-
.bases("Node")
|
|
72
|
-
.build("typeAnnotation")
|
|
73
|
-
.field("typeAnnotation", def("FlowType"));
|
|
74
|
-
|
|
75
|
-
def("NullableTypeAnnotation")
|
|
76
|
-
.bases("FlowType")
|
|
77
|
-
.build("typeAnnotation")
|
|
78
|
-
.field("typeAnnotation", def("FlowType"));
|
|
79
|
-
|
|
80
|
-
def("NullLiteralTypeAnnotation")
|
|
81
|
-
.bases("FlowType")
|
|
82
|
-
.build();
|
|
83
|
-
|
|
84
|
-
def("NullTypeAnnotation")
|
|
85
|
-
.bases("FlowType")
|
|
86
|
-
.build();
|
|
87
|
-
|
|
88
|
-
def("ThisTypeAnnotation")
|
|
89
|
-
.bases("FlowType")
|
|
90
|
-
.build();
|
|
91
|
-
|
|
92
|
-
def("ExistsTypeAnnotation")
|
|
93
|
-
.bases("FlowType")
|
|
94
|
-
.build();
|
|
95
|
-
|
|
96
|
-
def("ExistentialTypeParam")
|
|
97
|
-
.bases("FlowType")
|
|
98
|
-
.build();
|
|
99
|
-
|
|
100
|
-
def("FunctionTypeAnnotation")
|
|
101
|
-
.bases("FlowType")
|
|
102
|
-
.build("params", "returnType", "rest", "typeParameters")
|
|
103
|
-
.field("params", [def("FunctionTypeParam")])
|
|
104
|
-
.field("returnType", def("FlowType"))
|
|
105
|
-
.field("rest", or(def("FunctionTypeParam"), null))
|
|
106
|
-
.field("typeParameters", or(def("TypeParameterDeclaration"), null));
|
|
107
|
-
|
|
108
|
-
def("FunctionTypeParam")
|
|
109
|
-
.bases("Node")
|
|
110
|
-
.build("name", "typeAnnotation", "optional")
|
|
111
|
-
.field("name", def("Identifier"))
|
|
112
|
-
.field("typeAnnotation", def("FlowType"))
|
|
113
|
-
.field("optional", Boolean);
|
|
114
|
-
|
|
115
|
-
def("ArrayTypeAnnotation")
|
|
116
|
-
.bases("FlowType")
|
|
117
|
-
.build("elementType")
|
|
118
|
-
.field("elementType", def("FlowType"));
|
|
119
|
-
|
|
120
|
-
def("ObjectTypeAnnotation")
|
|
121
|
-
.bases("FlowType")
|
|
122
|
-
.build("properties", "indexers", "callProperties")
|
|
123
|
-
.field("properties", [
|
|
124
|
-
or(def("ObjectTypeProperty"),
|
|
125
|
-
def("ObjectTypeSpreadProperty"))
|
|
126
|
-
])
|
|
127
|
-
.field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray)
|
|
128
|
-
.field("callProperties",
|
|
129
|
-
[def("ObjectTypeCallProperty")],
|
|
130
|
-
defaults.emptyArray)
|
|
131
|
-
.field("exact", Boolean, defaults["false"]);
|
|
132
|
-
|
|
133
|
-
def("Variance")
|
|
134
|
-
.bases("Node")
|
|
135
|
-
.build("kind")
|
|
136
|
-
.field("kind", or("plus", "minus"));
|
|
137
|
-
|
|
138
|
-
var LegacyVariance = or(
|
|
139
|
-
def("Variance"),
|
|
140
|
-
"plus",
|
|
141
|
-
"minus",
|
|
142
|
-
null
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
def("ObjectTypeProperty")
|
|
146
|
-
.bases("Node")
|
|
147
|
-
.build("key", "value", "optional")
|
|
148
|
-
.field("key", or(def("Literal"), def("Identifier")))
|
|
149
|
-
.field("value", def("FlowType"))
|
|
150
|
-
.field("optional", Boolean)
|
|
151
|
-
.field("variance", LegacyVariance, defaults["null"]);
|
|
152
|
-
|
|
153
|
-
def("ObjectTypeIndexer")
|
|
154
|
-
.bases("Node")
|
|
155
|
-
.build("id", "key", "value")
|
|
156
|
-
.field("id", def("Identifier"))
|
|
157
|
-
.field("key", def("FlowType"))
|
|
158
|
-
.field("value", def("FlowType"))
|
|
159
|
-
.field("variance", LegacyVariance, defaults["null"]);
|
|
160
|
-
|
|
161
|
-
def("ObjectTypeCallProperty")
|
|
162
|
-
.bases("Node")
|
|
163
|
-
.build("value")
|
|
164
|
-
.field("value", def("FunctionTypeAnnotation"))
|
|
165
|
-
.field("static", Boolean, defaults["false"]);
|
|
166
|
-
|
|
167
|
-
def("QualifiedTypeIdentifier")
|
|
168
|
-
.bases("Node")
|
|
169
|
-
.build("qualification", "id")
|
|
170
|
-
.field("qualification",
|
|
171
|
-
or(def("Identifier"),
|
|
172
|
-
def("QualifiedTypeIdentifier")))
|
|
173
|
-
.field("id", def("Identifier"));
|
|
174
|
-
|
|
175
|
-
def("GenericTypeAnnotation")
|
|
176
|
-
.bases("FlowType")
|
|
177
|
-
.build("id", "typeParameters")
|
|
178
|
-
.field("id", or(def("Identifier"), def("QualifiedTypeIdentifier")))
|
|
179
|
-
.field("typeParameters", or(def("TypeParameterInstantiation"), null));
|
|
180
|
-
|
|
181
|
-
def("MemberTypeAnnotation")
|
|
182
|
-
.bases("FlowType")
|
|
183
|
-
.build("object", "property")
|
|
184
|
-
.field("object", def("Identifier"))
|
|
185
|
-
.field("property",
|
|
186
|
-
or(def("MemberTypeAnnotation"),
|
|
187
|
-
def("GenericTypeAnnotation")));
|
|
188
|
-
|
|
189
|
-
def("UnionTypeAnnotation")
|
|
190
|
-
.bases("FlowType")
|
|
191
|
-
.build("types")
|
|
192
|
-
.field("types", [def("FlowType")]);
|
|
193
|
-
|
|
194
|
-
def("IntersectionTypeAnnotation")
|
|
195
|
-
.bases("FlowType")
|
|
196
|
-
.build("types")
|
|
197
|
-
.field("types", [def("FlowType")]);
|
|
198
|
-
|
|
199
|
-
def("TypeofTypeAnnotation")
|
|
200
|
-
.bases("FlowType")
|
|
201
|
-
.build("argument")
|
|
202
|
-
.field("argument", def("FlowType"));
|
|
203
|
-
|
|
204
|
-
def("ObjectTypeSpreadProperty")
|
|
205
|
-
.bases("Node")
|
|
206
|
-
.build("argument")
|
|
207
|
-
.field("argument", def("FlowType"));
|
|
208
|
-
|
|
209
|
-
def("Identifier")
|
|
210
|
-
.field("typeAnnotation", or(def("TypeAnnotation"), null), defaults["null"]);
|
|
211
|
-
|
|
212
|
-
def("ObjectPattern")
|
|
213
|
-
.field("typeAnnotation", or(def("TypeAnnotation"), null), defaults["null"]);
|
|
214
|
-
|
|
215
|
-
def("TypeParameterDeclaration")
|
|
216
|
-
.bases("Node")
|
|
217
|
-
.build("params")
|
|
218
|
-
.field("params", [def("TypeParameter")]);
|
|
219
|
-
|
|
220
|
-
def("TypeParameterInstantiation")
|
|
221
|
-
.bases("Node")
|
|
222
|
-
.build("params")
|
|
223
|
-
.field("params", [def("FlowType")]);
|
|
224
|
-
|
|
225
|
-
def("TypeParameter")
|
|
226
|
-
.bases("FlowType")
|
|
227
|
-
.build("name", "variance", "bound")
|
|
228
|
-
.field("name", String)
|
|
229
|
-
.field("variance", LegacyVariance, defaults["null"])
|
|
230
|
-
.field("bound",
|
|
231
|
-
or(def("TypeAnnotation"), null),
|
|
232
|
-
defaults["null"]);
|
|
233
|
-
|
|
234
|
-
def("Function")
|
|
235
|
-
.field("returnType",
|
|
236
|
-
or(def("TypeAnnotation"), null),
|
|
237
|
-
defaults["null"])
|
|
238
|
-
.field("typeParameters",
|
|
239
|
-
or(def("TypeParameterDeclaration"), null),
|
|
240
|
-
defaults["null"]);
|
|
241
|
-
|
|
242
|
-
def("ClassProperty")
|
|
243
|
-
.build("key", "value", "typeAnnotation", "static")
|
|
244
|
-
.field("value", or(def("Expression"), null))
|
|
245
|
-
.field("typeAnnotation", or(def("TypeAnnotation"), null))
|
|
246
|
-
.field("static", Boolean, defaults["false"])
|
|
247
|
-
.field("variance", LegacyVariance, defaults["null"]);
|
|
248
|
-
|
|
249
|
-
["ClassDeclaration",
|
|
250
|
-
"ClassExpression",
|
|
251
|
-
].forEach(typeName => {
|
|
252
|
-
def(typeName)
|
|
253
|
-
.field("typeParameters",
|
|
254
|
-
or(def("TypeParameterDeclaration"), null),
|
|
255
|
-
defaults["null"])
|
|
256
|
-
.field("superTypeParameters",
|
|
257
|
-
or([def("GenericTypeAnnotation")], null),
|
|
258
|
-
defaults["null"]);
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
def("ClassImplements")
|
|
262
|
-
.bases("Node")
|
|
263
|
-
.build("id")
|
|
264
|
-
.field("id", def("Identifier"))
|
|
265
|
-
.field("superClass", or(def("Expression"), null), defaults["null"])
|
|
266
|
-
.field("typeParameters",
|
|
267
|
-
or(def("TypeParameterInstantiation"), null),
|
|
268
|
-
defaults["null"]);
|
|
269
|
-
|
|
270
|
-
["ClassDeclaration",
|
|
271
|
-
"ClassExpression",
|
|
272
|
-
].forEach(typeName => {
|
|
273
|
-
def(typeName)
|
|
274
|
-
.field("implements", [def("ClassImplements")], defaults.emptyArray);
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
def("InterfaceDeclaration")
|
|
278
|
-
.bases("Declaration")
|
|
279
|
-
.build("id", "body", "extends")
|
|
280
|
-
.field("id", def("Identifier"))
|
|
281
|
-
.field("typeParameters",
|
|
282
|
-
or(def("TypeParameterDeclaration"), null),
|
|
283
|
-
defaults["null"])
|
|
284
|
-
.field("body", def("ObjectTypeAnnotation"))
|
|
285
|
-
.field("extends", [def("InterfaceExtends")]);
|
|
286
|
-
|
|
287
|
-
def("DeclareInterface")
|
|
288
|
-
.bases("InterfaceDeclaration")
|
|
289
|
-
.build("id", "body", "extends");
|
|
290
|
-
|
|
291
|
-
def("InterfaceExtends")
|
|
292
|
-
.bases("Node")
|
|
293
|
-
.build("id")
|
|
294
|
-
.field("id", def("Identifier"))
|
|
295
|
-
.field("typeParameters", or(def("TypeParameterInstantiation"), null));
|
|
296
|
-
|
|
297
|
-
def("TypeAlias")
|
|
298
|
-
.bases("Declaration")
|
|
299
|
-
.build("id", "typeParameters", "right")
|
|
300
|
-
.field("id", def("Identifier"))
|
|
301
|
-
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
302
|
-
.field("right", def("FlowType"));
|
|
303
|
-
|
|
304
|
-
def("OpaqueType")
|
|
305
|
-
.bases("Declaration")
|
|
306
|
-
.build("id", "typeParameters", "impltype", "supertype")
|
|
307
|
-
.field("id", def("Identifier"))
|
|
308
|
-
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
309
|
-
.field("implType", def("FlowType"))
|
|
310
|
-
.field("superType", def("FlowType"));
|
|
311
|
-
|
|
312
|
-
def("DeclareTypeAlias")
|
|
313
|
-
.bases("TypeAlias")
|
|
314
|
-
.build("id", "typeParameters", "right");
|
|
315
|
-
|
|
316
|
-
def("DeclareOpaqueType")
|
|
317
|
-
.bases("TypeAlias")
|
|
318
|
-
.build("id", "typeParameters", "supertype");
|
|
319
|
-
|
|
320
|
-
def("TypeCastExpression")
|
|
321
|
-
.bases("Expression")
|
|
322
|
-
.build("expression", "typeAnnotation")
|
|
323
|
-
.field("expression", def("Expression"))
|
|
324
|
-
.field("typeAnnotation", def("TypeAnnotation"));
|
|
325
|
-
|
|
326
|
-
def("TupleTypeAnnotation")
|
|
327
|
-
.bases("FlowType")
|
|
328
|
-
.build("types")
|
|
329
|
-
.field("types", [def("FlowType")]);
|
|
330
|
-
|
|
331
|
-
def("DeclareVariable")
|
|
332
|
-
.bases("Statement")
|
|
333
|
-
.build("id")
|
|
334
|
-
.field("id", def("Identifier"));
|
|
335
|
-
|
|
336
|
-
def("DeclareFunction")
|
|
337
|
-
.bases("Statement")
|
|
338
|
-
.build("id")
|
|
339
|
-
.field("id", def("Identifier"));
|
|
340
|
-
|
|
341
|
-
def("DeclareClass")
|
|
342
|
-
.bases("InterfaceDeclaration")
|
|
343
|
-
.build("id");
|
|
344
|
-
|
|
345
|
-
def("DeclareModule")
|
|
346
|
-
.bases("Statement")
|
|
347
|
-
.build("id", "body")
|
|
348
|
-
.field("id", or(def("Identifier"), def("Literal")))
|
|
349
|
-
.field("body", def("BlockStatement"));
|
|
350
|
-
|
|
351
|
-
def("DeclareModuleExports")
|
|
352
|
-
.bases("Statement")
|
|
353
|
-
.build("typeAnnotation")
|
|
354
|
-
.field("typeAnnotation", def("TypeAnnotation"));
|
|
355
|
-
|
|
356
|
-
def("DeclareExportDeclaration")
|
|
357
|
-
.bases("Declaration")
|
|
358
|
-
.build("default", "declaration", "specifiers", "source")
|
|
359
|
-
.field("default", Boolean)
|
|
360
|
-
.field("declaration", or(
|
|
361
|
-
def("DeclareVariable"),
|
|
362
|
-
def("DeclareFunction"),
|
|
363
|
-
def("DeclareClass"),
|
|
364
|
-
def("FlowType"), // Implies default.
|
|
365
|
-
null
|
|
366
|
-
))
|
|
367
|
-
.field("specifiers", [or(
|
|
368
|
-
def("ExportSpecifier"),
|
|
369
|
-
def("ExportBatchSpecifier")
|
|
370
|
-
)], defaults.emptyArray)
|
|
371
|
-
.field("source", or(
|
|
372
|
-
def("Literal"),
|
|
373
|
-
null
|
|
374
|
-
), defaults["null"]);
|
|
375
|
-
|
|
376
|
-
def("DeclareExportAllDeclaration")
|
|
377
|
-
.bases("Declaration")
|
|
378
|
-
.build("source")
|
|
379
|
-
.field("source", or(
|
|
380
|
-
def("Literal"),
|
|
381
|
-
null
|
|
382
|
-
), defaults["null"]);
|
|
383
|
-
|
|
384
|
-
def("FlowPredicate").bases("Flow");
|
|
385
|
-
|
|
386
|
-
def("InferredPredicate")
|
|
387
|
-
.bases("FlowPredicate")
|
|
388
|
-
.build();
|
|
389
|
-
|
|
390
|
-
def("DeclaredPredicate")
|
|
391
|
-
.bases("FlowPredicate")
|
|
392
|
-
.build("value")
|
|
393
|
-
.field("value", def("Expression"));
|
|
1
|
+
"use strict";;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
394
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var es7_1 = __importDefault(require("./es7"));
|
|
7
|
+
var type_annotations_1 = __importDefault(require("./type-annotations"));
|
|
8
|
+
var types_1 = __importDefault(require("../lib/types"));
|
|
9
|
+
var shared_1 = __importDefault(require("../lib/shared"));
|
|
10
|
+
function default_1(fork) {
|
|
11
|
+
fork.use(es7_1.default);
|
|
12
|
+
fork.use(type_annotations_1.default);
|
|
13
|
+
var types = fork.use(types_1.default);
|
|
14
|
+
var def = types.Type.def;
|
|
15
|
+
var or = types.Type.or;
|
|
16
|
+
var defaults = fork.use(shared_1.default).defaults;
|
|
17
|
+
// Base types
|
|
18
|
+
def("Flow").bases("Node");
|
|
19
|
+
def("FlowType").bases("Flow");
|
|
20
|
+
// Type annotations
|
|
21
|
+
def("AnyTypeAnnotation")
|
|
22
|
+
.bases("FlowType")
|
|
23
|
+
.build();
|
|
24
|
+
def("EmptyTypeAnnotation")
|
|
25
|
+
.bases("FlowType")
|
|
26
|
+
.build();
|
|
27
|
+
def("MixedTypeAnnotation")
|
|
28
|
+
.bases("FlowType")
|
|
29
|
+
.build();
|
|
30
|
+
def("VoidTypeAnnotation")
|
|
31
|
+
.bases("FlowType")
|
|
32
|
+
.build();
|
|
33
|
+
def("NumberTypeAnnotation")
|
|
34
|
+
.bases("FlowType")
|
|
35
|
+
.build();
|
|
36
|
+
def("NumberLiteralTypeAnnotation")
|
|
37
|
+
.bases("FlowType")
|
|
38
|
+
.build("value", "raw")
|
|
39
|
+
.field("value", Number)
|
|
40
|
+
.field("raw", String);
|
|
41
|
+
// Babylon 6 differs in AST from Flow
|
|
42
|
+
// same as NumberLiteralTypeAnnotation
|
|
43
|
+
def("NumericLiteralTypeAnnotation")
|
|
44
|
+
.bases("FlowType")
|
|
45
|
+
.build("value", "raw")
|
|
46
|
+
.field("value", Number)
|
|
47
|
+
.field("raw", String);
|
|
48
|
+
def("StringTypeAnnotation")
|
|
49
|
+
.bases("FlowType")
|
|
50
|
+
.build();
|
|
51
|
+
def("StringLiteralTypeAnnotation")
|
|
52
|
+
.bases("FlowType")
|
|
53
|
+
.build("value", "raw")
|
|
54
|
+
.field("value", String)
|
|
55
|
+
.field("raw", String);
|
|
56
|
+
def("BooleanTypeAnnotation")
|
|
57
|
+
.bases("FlowType")
|
|
58
|
+
.build();
|
|
59
|
+
def("BooleanLiteralTypeAnnotation")
|
|
60
|
+
.bases("FlowType")
|
|
61
|
+
.build("value", "raw")
|
|
62
|
+
.field("value", Boolean)
|
|
63
|
+
.field("raw", String);
|
|
64
|
+
def("TypeAnnotation")
|
|
65
|
+
.bases("Node")
|
|
66
|
+
.build("typeAnnotation")
|
|
67
|
+
.field("typeAnnotation", def("FlowType"));
|
|
68
|
+
def("NullableTypeAnnotation")
|
|
69
|
+
.bases("FlowType")
|
|
70
|
+
.build("typeAnnotation")
|
|
71
|
+
.field("typeAnnotation", def("FlowType"));
|
|
72
|
+
def("NullLiteralTypeAnnotation")
|
|
73
|
+
.bases("FlowType")
|
|
74
|
+
.build();
|
|
75
|
+
def("NullTypeAnnotation")
|
|
76
|
+
.bases("FlowType")
|
|
77
|
+
.build();
|
|
78
|
+
def("ThisTypeAnnotation")
|
|
79
|
+
.bases("FlowType")
|
|
80
|
+
.build();
|
|
81
|
+
def("ExistsTypeAnnotation")
|
|
82
|
+
.bases("FlowType")
|
|
83
|
+
.build();
|
|
84
|
+
def("ExistentialTypeParam")
|
|
85
|
+
.bases("FlowType")
|
|
86
|
+
.build();
|
|
87
|
+
def("FunctionTypeAnnotation")
|
|
88
|
+
.bases("FlowType")
|
|
89
|
+
.build("params", "returnType", "rest", "typeParameters")
|
|
90
|
+
.field("params", [def("FunctionTypeParam")])
|
|
91
|
+
.field("returnType", def("FlowType"))
|
|
92
|
+
.field("rest", or(def("FunctionTypeParam"), null))
|
|
93
|
+
.field("typeParameters", or(def("TypeParameterDeclaration"), null));
|
|
94
|
+
def("FunctionTypeParam")
|
|
95
|
+
.bases("Node")
|
|
96
|
+
.build("name", "typeAnnotation", "optional")
|
|
97
|
+
.field("name", def("Identifier"))
|
|
98
|
+
.field("typeAnnotation", def("FlowType"))
|
|
99
|
+
.field("optional", Boolean);
|
|
100
|
+
def("ArrayTypeAnnotation")
|
|
101
|
+
.bases("FlowType")
|
|
102
|
+
.build("elementType")
|
|
103
|
+
.field("elementType", def("FlowType"));
|
|
104
|
+
def("ObjectTypeAnnotation")
|
|
105
|
+
.bases("FlowType")
|
|
106
|
+
.build("properties", "indexers", "callProperties")
|
|
107
|
+
.field("properties", [
|
|
108
|
+
or(def("ObjectTypeProperty"), def("ObjectTypeSpreadProperty"))
|
|
109
|
+
])
|
|
110
|
+
.field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray)
|
|
111
|
+
.field("callProperties", [def("ObjectTypeCallProperty")], defaults.emptyArray)
|
|
112
|
+
.field("inexact", or(Boolean, void 0), defaults["undefined"])
|
|
113
|
+
.field("exact", Boolean, defaults["false"])
|
|
114
|
+
.field("internalSlots", [def("ObjectTypeInternalSlot")], defaults.emptyArray);
|
|
115
|
+
def("Variance")
|
|
116
|
+
.bases("Node")
|
|
117
|
+
.build("kind")
|
|
118
|
+
.field("kind", or("plus", "minus"));
|
|
119
|
+
var LegacyVariance = or(def("Variance"), "plus", "minus", null);
|
|
120
|
+
def("ObjectTypeProperty")
|
|
121
|
+
.bases("Node")
|
|
122
|
+
.build("key", "value", "optional")
|
|
123
|
+
.field("key", or(def("Literal"), def("Identifier")))
|
|
124
|
+
.field("value", def("FlowType"))
|
|
125
|
+
.field("optional", Boolean)
|
|
126
|
+
.field("variance", LegacyVariance, defaults["null"]);
|
|
127
|
+
def("ObjectTypeIndexer")
|
|
128
|
+
.bases("Node")
|
|
129
|
+
.build("id", "key", "value")
|
|
130
|
+
.field("id", def("Identifier"))
|
|
131
|
+
.field("key", def("FlowType"))
|
|
132
|
+
.field("value", def("FlowType"))
|
|
133
|
+
.field("variance", LegacyVariance, defaults["null"]);
|
|
134
|
+
def("ObjectTypeCallProperty")
|
|
135
|
+
.bases("Node")
|
|
136
|
+
.build("value")
|
|
137
|
+
.field("value", def("FunctionTypeAnnotation"))
|
|
138
|
+
.field("static", Boolean, defaults["false"]);
|
|
139
|
+
def("QualifiedTypeIdentifier")
|
|
140
|
+
.bases("Node")
|
|
141
|
+
.build("qualification", "id")
|
|
142
|
+
.field("qualification", or(def("Identifier"), def("QualifiedTypeIdentifier")))
|
|
143
|
+
.field("id", def("Identifier"));
|
|
144
|
+
def("GenericTypeAnnotation")
|
|
145
|
+
.bases("FlowType")
|
|
146
|
+
.build("id", "typeParameters")
|
|
147
|
+
.field("id", or(def("Identifier"), def("QualifiedTypeIdentifier")))
|
|
148
|
+
.field("typeParameters", or(def("TypeParameterInstantiation"), null));
|
|
149
|
+
def("MemberTypeAnnotation")
|
|
150
|
+
.bases("FlowType")
|
|
151
|
+
.build("object", "property")
|
|
152
|
+
.field("object", def("Identifier"))
|
|
153
|
+
.field("property", or(def("MemberTypeAnnotation"), def("GenericTypeAnnotation")));
|
|
154
|
+
def("UnionTypeAnnotation")
|
|
155
|
+
.bases("FlowType")
|
|
156
|
+
.build("types")
|
|
157
|
+
.field("types", [def("FlowType")]);
|
|
158
|
+
def("IntersectionTypeAnnotation")
|
|
159
|
+
.bases("FlowType")
|
|
160
|
+
.build("types")
|
|
161
|
+
.field("types", [def("FlowType")]);
|
|
162
|
+
def("TypeofTypeAnnotation")
|
|
163
|
+
.bases("FlowType")
|
|
164
|
+
.build("argument")
|
|
165
|
+
.field("argument", def("FlowType"));
|
|
166
|
+
def("ObjectTypeSpreadProperty")
|
|
167
|
+
.bases("Node")
|
|
168
|
+
.build("argument")
|
|
169
|
+
.field("argument", def("FlowType"));
|
|
170
|
+
def("ObjectTypeInternalSlot")
|
|
171
|
+
.bases("Node")
|
|
172
|
+
.build("id", "value", "optional", "static", "method")
|
|
173
|
+
.field("id", def("Identifier"))
|
|
174
|
+
.field("value", def("FlowType"))
|
|
175
|
+
.field("optional", Boolean)
|
|
176
|
+
.field("static", Boolean)
|
|
177
|
+
.field("method", Boolean);
|
|
178
|
+
def("TypeParameterDeclaration")
|
|
179
|
+
.bases("Node")
|
|
180
|
+
.build("params")
|
|
181
|
+
.field("params", [def("TypeParameter")]);
|
|
182
|
+
def("TypeParameterInstantiation")
|
|
183
|
+
.bases("Node")
|
|
184
|
+
.build("params")
|
|
185
|
+
.field("params", [def("FlowType")]);
|
|
186
|
+
def("TypeParameter")
|
|
187
|
+
.bases("FlowType")
|
|
188
|
+
.build("name", "variance", "bound")
|
|
189
|
+
.field("name", String)
|
|
190
|
+
.field("variance", LegacyVariance, defaults["null"])
|
|
191
|
+
.field("bound", or(def("TypeAnnotation"), null), defaults["null"]);
|
|
192
|
+
def("ClassProperty")
|
|
193
|
+
.field("variance", LegacyVariance, defaults["null"]);
|
|
194
|
+
def("ClassImplements")
|
|
195
|
+
.bases("Node")
|
|
196
|
+
.build("id")
|
|
197
|
+
.field("id", def("Identifier"))
|
|
198
|
+
.field("superClass", or(def("Expression"), null), defaults["null"])
|
|
199
|
+
.field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
|
|
200
|
+
def("InterfaceTypeAnnotation")
|
|
201
|
+
.bases("FlowType")
|
|
202
|
+
.build("body", "extends")
|
|
203
|
+
.field("body", def("ObjectTypeAnnotation"))
|
|
204
|
+
.field("extends", or([def("InterfaceExtends")], null), defaults["null"]);
|
|
205
|
+
def("InterfaceDeclaration")
|
|
206
|
+
.bases("Declaration")
|
|
207
|
+
.build("id", "body", "extends")
|
|
208
|
+
.field("id", def("Identifier"))
|
|
209
|
+
.field("typeParameters", or(def("TypeParameterDeclaration"), null), defaults["null"])
|
|
210
|
+
.field("body", def("ObjectTypeAnnotation"))
|
|
211
|
+
.field("extends", [def("InterfaceExtends")]);
|
|
212
|
+
def("DeclareInterface")
|
|
213
|
+
.bases("InterfaceDeclaration")
|
|
214
|
+
.build("id", "body", "extends");
|
|
215
|
+
def("InterfaceExtends")
|
|
216
|
+
.bases("Node")
|
|
217
|
+
.build("id")
|
|
218
|
+
.field("id", def("Identifier"))
|
|
219
|
+
.field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
|
|
220
|
+
def("TypeAlias")
|
|
221
|
+
.bases("Declaration")
|
|
222
|
+
.build("id", "typeParameters", "right")
|
|
223
|
+
.field("id", def("Identifier"))
|
|
224
|
+
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
225
|
+
.field("right", def("FlowType"));
|
|
226
|
+
def("OpaqueType")
|
|
227
|
+
.bases("Declaration")
|
|
228
|
+
.build("id", "typeParameters", "impltype", "supertype")
|
|
229
|
+
.field("id", def("Identifier"))
|
|
230
|
+
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
231
|
+
.field("impltype", def("FlowType"))
|
|
232
|
+
.field("supertype", def("FlowType"));
|
|
233
|
+
def("DeclareTypeAlias")
|
|
234
|
+
.bases("TypeAlias")
|
|
235
|
+
.build("id", "typeParameters", "right");
|
|
236
|
+
def("DeclareOpaqueType")
|
|
237
|
+
.bases("TypeAlias")
|
|
238
|
+
.build("id", "typeParameters", "supertype");
|
|
239
|
+
def("TypeCastExpression")
|
|
240
|
+
.bases("Expression")
|
|
241
|
+
.build("expression", "typeAnnotation")
|
|
242
|
+
.field("expression", def("Expression"))
|
|
243
|
+
.field("typeAnnotation", def("TypeAnnotation"));
|
|
244
|
+
def("TupleTypeAnnotation")
|
|
245
|
+
.bases("FlowType")
|
|
246
|
+
.build("types")
|
|
247
|
+
.field("types", [def("FlowType")]);
|
|
248
|
+
def("DeclareVariable")
|
|
249
|
+
.bases("Statement")
|
|
250
|
+
.build("id")
|
|
251
|
+
.field("id", def("Identifier"));
|
|
252
|
+
def("DeclareFunction")
|
|
253
|
+
.bases("Statement")
|
|
254
|
+
.build("id")
|
|
255
|
+
.field("id", def("Identifier"));
|
|
256
|
+
def("DeclareClass")
|
|
257
|
+
.bases("InterfaceDeclaration")
|
|
258
|
+
.build("id");
|
|
259
|
+
def("DeclareModule")
|
|
260
|
+
.bases("Statement")
|
|
261
|
+
.build("id", "body")
|
|
262
|
+
.field("id", or(def("Identifier"), def("Literal")))
|
|
263
|
+
.field("body", def("BlockStatement"));
|
|
264
|
+
def("DeclareModuleExports")
|
|
265
|
+
.bases("Statement")
|
|
266
|
+
.build("typeAnnotation")
|
|
267
|
+
.field("typeAnnotation", def("TypeAnnotation"));
|
|
268
|
+
def("DeclareExportDeclaration")
|
|
269
|
+
.bases("Declaration")
|
|
270
|
+
.build("default", "declaration", "specifiers", "source")
|
|
271
|
+
.field("default", Boolean)
|
|
272
|
+
.field("declaration", or(def("DeclareVariable"), def("DeclareFunction"), def("DeclareClass"), def("FlowType"), // Implies default.
|
|
273
|
+
null))
|
|
274
|
+
.field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
|
|
275
|
+
.field("source", or(def("Literal"), null), defaults["null"]);
|
|
276
|
+
def("DeclareExportAllDeclaration")
|
|
277
|
+
.bases("Declaration")
|
|
278
|
+
.build("source")
|
|
279
|
+
.field("source", or(def("Literal"), null), defaults["null"]);
|
|
280
|
+
def("FlowPredicate").bases("Flow");
|
|
281
|
+
def("InferredPredicate")
|
|
282
|
+
.bases("FlowPredicate")
|
|
283
|
+
.build();
|
|
284
|
+
def("DeclaredPredicate")
|
|
285
|
+
.bases("FlowPredicate")
|
|
286
|
+
.build("value")
|
|
287
|
+
.field("value", def("Expression"));
|
|
288
|
+
}
|
|
289
|
+
exports.default = default_1;
|
|
290
|
+
module.exports = exports["default"];
|
package/def/jsx.d.ts
ADDED