1 | # babel-types
|
2 |
|
3 | > This module contains methods for building ASTs manually and for checking the types of AST nodes.
|
4 |
|
5 | ## Install
|
6 |
|
7 | ```sh
|
8 | npm install --save-dev babel-types
|
9 | ```
|
10 |
|
11 | ## API
|
12 |
|
13 |
|
14 |
|
15 | ### anyTypeAnnotation
|
16 | ```javascript
|
17 | t.anyTypeAnnotation()
|
18 | ```
|
19 |
|
20 | See also `t.isAnyTypeAnnotation(node, opts)` and `t.assertAnyTypeAnnotation(node, opts)`.
|
21 |
|
22 | Aliases: `Flow`, `FlowBaseAnnotation`
|
23 |
|
24 |
|
25 | ---
|
26 |
|
27 | ### arrayExpression
|
28 | ```javascript
|
29 | t.arrayExpression(elements)
|
30 | ```
|
31 |
|
32 | See also `t.isArrayExpression(node, opts)` and `t.assertArrayExpression(node, opts)`.
|
33 |
|
34 | Aliases: `Expression`
|
35 |
|
36 | - `elements`: `Array<null | Expression | SpreadElement>` (default: `[]`)
|
37 |
|
38 | ---
|
39 |
|
40 | ### arrayPattern
|
41 | ```javascript
|
42 | t.arrayPattern(elements, typeAnnotation)
|
43 | ```
|
44 |
|
45 | See also `t.isArrayPattern(node, opts)` and `t.assertArrayPattern(node, opts)`.
|
46 |
|
47 | Aliases: `Pattern`, `LVal`
|
48 |
|
49 | - `elements`: `Array<Expression>` (required)
|
50 | - `typeAnnotation` (required)
|
51 | - `decorators`: `Array<Decorator>` (default: `null`)
|
52 |
|
53 | ---
|
54 |
|
55 | ### arrayTypeAnnotation
|
56 | ```javascript
|
57 | t.arrayTypeAnnotation(elementType)
|
58 | ```
|
59 |
|
60 | See also `t.isArrayTypeAnnotation(node, opts)` and `t.assertArrayTypeAnnotation(node, opts)`.
|
61 |
|
62 | Aliases: `Flow`
|
63 |
|
64 | - `elementType` (required)
|
65 |
|
66 | ---
|
67 |
|
68 | ### arrowFunctionExpression
|
69 | ```javascript
|
70 | t.arrowFunctionExpression(params, body, async)
|
71 | ```
|
72 |
|
73 | See also `t.isArrowFunctionExpression(node, opts)` and `t.assertArrowFunctionExpression(node, opts)`.
|
74 |
|
75 | Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish`
|
76 |
|
77 | - `params`: `Array<LVal>` (required)
|
78 | - `body`: `BlockStatement | Expression` (required)
|
79 | - `async`: `boolean` (default: `false`)
|
80 | - `returnType` (default: `null`)
|
81 | - `typeParameters` (default: `null`)
|
82 |
|
83 | ---
|
84 |
|
85 | ### assignmentExpression
|
86 | ```javascript
|
87 | t.assignmentExpression(operator, left, right)
|
88 | ```
|
89 |
|
90 | See also `t.isAssignmentExpression(node, opts)` and `t.assertAssignmentExpression(node, opts)`.
|
91 |
|
92 | Aliases: `Expression`
|
93 |
|
94 | - `operator`: `string` (required)
|
95 | - `left`: `LVal` (required)
|
96 | - `right`: `Expression` (required)
|
97 |
|
98 | ---
|
99 |
|
100 | ### assignmentPattern
|
101 | ```javascript
|
102 | t.assignmentPattern(left, right)
|
103 | ```
|
104 |
|
105 | See also `t.isAssignmentPattern(node, opts)` and `t.assertAssignmentPattern(node, opts)`.
|
106 |
|
107 | Aliases: `Pattern`, `LVal`
|
108 |
|
109 | - `left`: `Identifier` (required)
|
110 | - `right`: `Expression` (required)
|
111 | - `decorators`: `Array<Decorator>` (default: `null`)
|
112 |
|
113 | ---
|
114 |
|
115 | ### awaitExpression
|
116 | ```javascript
|
117 | t.awaitExpression(argument)
|
118 | ```
|
119 |
|
120 | See also `t.isAwaitExpression(node, opts)` and `t.assertAwaitExpression(node, opts)`.
|
121 |
|
122 | Aliases: `Expression`, `Terminatorless`
|
123 |
|
124 | - `argument`: `Expression` (required)
|
125 |
|
126 | ---
|
127 |
|
128 | ### binaryExpression
|
129 | ```javascript
|
130 | t.binaryExpression(operator, left, right)
|
131 | ```
|
132 |
|
133 | See also `t.isBinaryExpression(node, opts)` and `t.assertBinaryExpression(node, opts)`.
|
134 |
|
135 | Aliases: `Binary`, `Expression`
|
136 |
|
137 | - `operator`: `'+' | '-' | '/' | '%' | '*' | '**' | '&' | '|' | '>>' | '>>>' | '<<' | '^' | '==' | '===' | '!=' | '!==' | 'in' | 'instanceof' | '>' | '<' | '>=' | '<='` (required)
|
138 | - `left`: `Expression` (required)
|
139 | - `right`: `Expression` (required)
|
140 |
|
141 | ---
|
142 |
|
143 | ### bindExpression
|
144 | ```javascript
|
145 | t.bindExpression(object, callee)
|
146 | ```
|
147 |
|
148 | See also `t.isBindExpression(node, opts)` and `t.assertBindExpression(node, opts)`.
|
149 |
|
150 | Aliases: `Expression`
|
151 |
|
152 | - `object` (required)
|
153 | - `callee` (required)
|
154 |
|
155 | ---
|
156 |
|
157 | ### blockStatement
|
158 | ```javascript
|
159 | t.blockStatement(body, directives)
|
160 | ```
|
161 |
|
162 | See also `t.isBlockStatement(node, opts)` and `t.assertBlockStatement(node, opts)`.
|
163 |
|
164 | Aliases: `Scopable`, `BlockParent`, `Block`, `Statement`
|
165 |
|
166 | - `body`: `Array<Statement>` (required)
|
167 | - `directives`: `Array<Directive>` (default: `[]`)
|
168 |
|
169 | ---
|
170 |
|
171 | ### booleanLiteral
|
172 | ```javascript
|
173 | t.booleanLiteral(value)
|
174 | ```
|
175 |
|
176 | See also `t.isBooleanLiteral(node, opts)` and `t.assertBooleanLiteral(node, opts)`.
|
177 |
|
178 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
179 |
|
180 | - `value`: `boolean` (required)
|
181 |
|
182 | ---
|
183 |
|
184 | ### booleanLiteralTypeAnnotation
|
185 | ```javascript
|
186 | t.booleanLiteralTypeAnnotation()
|
187 | ```
|
188 |
|
189 | See also `t.isBooleanLiteralTypeAnnotation(node, opts)` and `t.assertBooleanLiteralTypeAnnotation(node, opts)`.
|
190 |
|
191 | Aliases: `Flow`
|
192 |
|
193 |
|
194 | ---
|
195 |
|
196 | ### booleanTypeAnnotation
|
197 | ```javascript
|
198 | t.booleanTypeAnnotation()
|
199 | ```
|
200 |
|
201 | See also `t.isBooleanTypeAnnotation(node, opts)` and `t.assertBooleanTypeAnnotation(node, opts)`.
|
202 |
|
203 | Aliases: `Flow`, `FlowBaseAnnotation`
|
204 |
|
205 |
|
206 | ---
|
207 |
|
208 | ### breakStatement
|
209 | ```javascript
|
210 | t.breakStatement(label)
|
211 | ```
|
212 |
|
213 | See also `t.isBreakStatement(node, opts)` and `t.assertBreakStatement(node, opts)`.
|
214 |
|
215 | Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
|
216 |
|
217 | - `label`: `Identifier` (default: `null`)
|
218 |
|
219 | ---
|
220 |
|
221 | ### callExpression
|
222 | ```javascript
|
223 | t.callExpression(callee, arguments)
|
224 | ```
|
225 |
|
226 | See also `t.isCallExpression(node, opts)` and `t.assertCallExpression(node, opts)`.
|
227 |
|
228 | Aliases: `Expression`
|
229 |
|
230 | - `callee`: `Expression` (required)
|
231 | - `arguments`: `Array<Expression | SpreadElement>` (required)
|
232 |
|
233 | ---
|
234 |
|
235 | ### catchClause
|
236 | ```javascript
|
237 | t.catchClause(param, body)
|
238 | ```
|
239 |
|
240 | See also `t.isCatchClause(node, opts)` and `t.assertCatchClause(node, opts)`.
|
241 |
|
242 | Aliases: `Scopable`
|
243 |
|
244 | - `param`: `Identifier` (required)
|
245 | - `body`: `BlockStatement` (required)
|
246 |
|
247 | ---
|
248 |
|
249 | ### classBody
|
250 | ```javascript
|
251 | t.classBody(body)
|
252 | ```
|
253 |
|
254 | See also `t.isClassBody(node, opts)` and `t.assertClassBody(node, opts)`.
|
255 |
|
256 | - `body`: `Array<ClassMethod | ClassProperty>` (required)
|
257 |
|
258 | ---
|
259 |
|
260 | ### classDeclaration
|
261 | ```javascript
|
262 | t.classDeclaration(id, superClass, body, decorators)
|
263 | ```
|
264 |
|
265 | See also `t.isClassDeclaration(node, opts)` and `t.assertClassDeclaration(node, opts)`.
|
266 |
|
267 | Aliases: `Scopable`, `Class`, `Statement`, `Declaration`, `Pureish`
|
268 |
|
269 | - `id`: `Identifier` (required)
|
270 | - `superClass`: `Expression` (default: `null`)
|
271 | - `body`: `ClassBody` (required)
|
272 | - `decorators`: `Array<Decorator>` (required)
|
273 | - `implements` (default: `null`)
|
274 | - `mixins` (default: `null`)
|
275 | - `superTypeParameters` (default: `null`)
|
276 | - `typeParameters` (default: `null`)
|
277 |
|
278 | ---
|
279 |
|
280 | ### classExpression
|
281 | ```javascript
|
282 | t.classExpression(id, superClass, body, decorators)
|
283 | ```
|
284 |
|
285 | See also `t.isClassExpression(node, opts)` and `t.assertClassExpression(node, opts)`.
|
286 |
|
287 | Aliases: `Scopable`, `Class`, `Expression`, `Pureish`
|
288 |
|
289 | - `id`: `Identifier` (default: `null`)
|
290 | - `superClass`: `Expression` (default: `null`)
|
291 | - `body`: `ClassBody` (required)
|
292 | - `decorators`: `Array<Decorator>` (required)
|
293 | - `implements` (default: `null`)
|
294 | - `mixins` (default: `null`)
|
295 | - `superTypeParameters` (default: `null`)
|
296 | - `typeParameters` (default: `null`)
|
297 |
|
298 | ---
|
299 |
|
300 | ### classImplements
|
301 | ```javascript
|
302 | t.classImplements(id, typeParameters)
|
303 | ```
|
304 |
|
305 | See also `t.isClassImplements(node, opts)` and `t.assertClassImplements(node, opts)`.
|
306 |
|
307 | Aliases: `Flow`
|
308 |
|
309 | - `id` (required)
|
310 | - `typeParameters` (required)
|
311 |
|
312 | ---
|
313 |
|
314 | ### classMethod
|
315 | ```javascript
|
316 | t.classMethod(kind, key, params, body, computed, static)
|
317 | ```
|
318 |
|
319 | See also `t.isClassMethod(node, opts)` and `t.assertClassMethod(node, opts)`.
|
320 |
|
321 | Aliases: `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`
|
322 |
|
323 | - `kind`: `"get" | "set" | "method" | "constructor"` (default: `'method'`)
|
324 | - `key`if computed then `Expression` else `Identifier | Literal` (required)
|
325 | - `params`: `Array<LVal>` (required)
|
326 | - `body`: `BlockStatement` (required)
|
327 | - `computed`: `boolean` (default: `false`)
|
328 | - `static`: `boolean` (default: `false`)
|
329 | - `async`: `boolean` (default: `false`)
|
330 | - `decorators` (default: `null`)
|
331 | - `generator`: `boolean` (default: `false`)
|
332 | - `returnType` (default: `null`)
|
333 | - `typeParameters` (default: `null`)
|
334 |
|
335 | ---
|
336 |
|
337 | ### classProperty
|
338 | ```javascript
|
339 | t.classProperty(key, value, typeAnnotation, decorators, computed)
|
340 | ```
|
341 |
|
342 | See also `t.isClassProperty(node, opts)` and `t.assertClassProperty(node, opts)`.
|
343 |
|
344 | Aliases: `Property`
|
345 |
|
346 | - `key` (required)
|
347 | - `value` (required)
|
348 | - `typeAnnotation` (required)
|
349 | - `decorators` (required)
|
350 | - `computed`: `boolean` (default: `false`)
|
351 |
|
352 | ---
|
353 |
|
354 | ### conditionalExpression
|
355 | ```javascript
|
356 | t.conditionalExpression(test, consequent, alternate)
|
357 | ```
|
358 |
|
359 | See also `t.isConditionalExpression(node, opts)` and `t.assertConditionalExpression(node, opts)`.
|
360 |
|
361 | Aliases: `Expression`, `Conditional`
|
362 |
|
363 | - `test`: `Expression` (required)
|
364 | - `consequent`: `Expression` (required)
|
365 | - `alternate`: `Expression` (required)
|
366 |
|
367 | ---
|
368 |
|
369 | ### continueStatement
|
370 | ```javascript
|
371 | t.continueStatement(label)
|
372 | ```
|
373 |
|
374 | See also `t.isContinueStatement(node, opts)` and `t.assertContinueStatement(node, opts)`.
|
375 |
|
376 | Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
|
377 |
|
378 | - `label`: `Identifier` (default: `null`)
|
379 |
|
380 | ---
|
381 |
|
382 | ### debuggerStatement
|
383 | ```javascript
|
384 | t.debuggerStatement()
|
385 | ```
|
386 |
|
387 | See also `t.isDebuggerStatement(node, opts)` and `t.assertDebuggerStatement(node, opts)`.
|
388 |
|
389 | Aliases: `Statement`
|
390 |
|
391 |
|
392 | ---
|
393 |
|
394 | ### declareClass
|
395 | ```javascript
|
396 | t.declareClass(id, typeParameters, extends, body)
|
397 | ```
|
398 |
|
399 | See also `t.isDeclareClass(node, opts)` and `t.assertDeclareClass(node, opts)`.
|
400 |
|
401 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
402 |
|
403 | - `id` (required)
|
404 | - `typeParameters` (required)
|
405 | - `extends` (required)
|
406 | - `body` (required)
|
407 |
|
408 | ---
|
409 |
|
410 | ### declareFunction
|
411 | ```javascript
|
412 | t.declareFunction(id)
|
413 | ```
|
414 |
|
415 | See also `t.isDeclareFunction(node, opts)` and `t.assertDeclareFunction(node, opts)`.
|
416 |
|
417 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
418 |
|
419 | - `id` (required)
|
420 |
|
421 | ---
|
422 |
|
423 | ### declareInterface
|
424 | ```javascript
|
425 | t.declareInterface(id, typeParameters, extends, body)
|
426 | ```
|
427 |
|
428 | See also `t.isDeclareInterface(node, opts)` and `t.assertDeclareInterface(node, opts)`.
|
429 |
|
430 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
431 |
|
432 | - `id` (required)
|
433 | - `typeParameters` (required)
|
434 | - `extends` (required)
|
435 | - `body` (required)
|
436 |
|
437 | ---
|
438 |
|
439 | ### declareModule
|
440 | ```javascript
|
441 | t.declareModule(id, body)
|
442 | ```
|
443 |
|
444 | See also `t.isDeclareModule(node, opts)` and `t.assertDeclareModule(node, opts)`.
|
445 |
|
446 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
447 |
|
448 | - `id` (required)
|
449 | - `body` (required)
|
450 |
|
451 | ---
|
452 |
|
453 | ### declareModuleExports
|
454 | ```javascript
|
455 | t.declareModuleExports(typeAnnotation)
|
456 | ```
|
457 |
|
458 | See also `t.isDeclareModuleExports(node, opts)` and `t.assertDeclareModuleExports(node, opts)`.
|
459 |
|
460 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
461 |
|
462 | - `typeAnnotation` (required)
|
463 |
|
464 | ---
|
465 |
|
466 | ### declareTypeAlias
|
467 | ```javascript
|
468 | t.declareTypeAlias(id, typeParameters, right)
|
469 | ```
|
470 |
|
471 | See also `t.isDeclareTypeAlias(node, opts)` and `t.assertDeclareTypeAlias(node, opts)`.
|
472 |
|
473 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
474 |
|
475 | - `id` (required)
|
476 | - `typeParameters` (required)
|
477 | - `right` (required)
|
478 |
|
479 | ---
|
480 |
|
481 | ### declareVariable
|
482 | ```javascript
|
483 | t.declareVariable(id)
|
484 | ```
|
485 |
|
486 | See also `t.isDeclareVariable(node, opts)` and `t.assertDeclareVariable(node, opts)`.
|
487 |
|
488 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
489 |
|
490 | - `id` (required)
|
491 |
|
492 | ---
|
493 |
|
494 | ### decorator
|
495 | ```javascript
|
496 | t.decorator(expression)
|
497 | ```
|
498 |
|
499 | See also `t.isDecorator(node, opts)` and `t.assertDecorator(node, opts)`.
|
500 |
|
501 | - `expression`: `Expression` (required)
|
502 |
|
503 | ---
|
504 |
|
505 | ### directive
|
506 | ```javascript
|
507 | t.directive(value)
|
508 | ```
|
509 |
|
510 | See also `t.isDirective(node, opts)` and `t.assertDirective(node, opts)`.
|
511 |
|
512 | - `value`: `DirectiveLiteral` (required)
|
513 |
|
514 | ---
|
515 |
|
516 | ### directiveLiteral
|
517 | ```javascript
|
518 | t.directiveLiteral(value)
|
519 | ```
|
520 |
|
521 | See also `t.isDirectiveLiteral(node, opts)` and `t.assertDirectiveLiteral(node, opts)`.
|
522 |
|
523 | - `value`: `string` (required)
|
524 |
|
525 | ---
|
526 |
|
527 | ### doExpression
|
528 | ```javascript
|
529 | t.doExpression(body)
|
530 | ```
|
531 |
|
532 | See also `t.isDoExpression(node, opts)` and `t.assertDoExpression(node, opts)`.
|
533 |
|
534 | Aliases: `Expression`
|
535 |
|
536 | - `body`: `BlockStatement` (required)
|
537 |
|
538 | ---
|
539 |
|
540 | ### doWhileStatement
|
541 | ```javascript
|
542 | t.doWhileStatement(test, body)
|
543 | ```
|
544 |
|
545 | See also `t.isDoWhileStatement(node, opts)` and `t.assertDoWhileStatement(node, opts)`.
|
546 |
|
547 | Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable`
|
548 |
|
549 | - `test`: `Expression` (required)
|
550 | - `body`: `Statement` (required)
|
551 |
|
552 | ---
|
553 |
|
554 | ### emptyStatement
|
555 | ```javascript
|
556 | t.emptyStatement()
|
557 | ```
|
558 |
|
559 | See also `t.isEmptyStatement(node, opts)` and `t.assertEmptyStatement(node, opts)`.
|
560 |
|
561 | Aliases: `Statement`
|
562 |
|
563 |
|
564 | ---
|
565 |
|
566 | ### emptyTypeAnnotation
|
567 | ```javascript
|
568 | t.emptyTypeAnnotation()
|
569 | ```
|
570 |
|
571 | See also `t.isEmptyTypeAnnotation(node, opts)` and `t.assertEmptyTypeAnnotation(node, opts)`.
|
572 |
|
573 | Aliases: `Flow`, `FlowBaseAnnotation`
|
574 |
|
575 |
|
576 | ---
|
577 |
|
578 | ### existsTypeAnnotation
|
579 | ```javascript
|
580 | t.existsTypeAnnotation()
|
581 | ```
|
582 |
|
583 | See also `t.isExistsTypeAnnotation(node, opts)` and `t.assertExistsTypeAnnotation(node, opts)`.
|
584 |
|
585 | Aliases: `Flow`
|
586 |
|
587 |
|
588 | ---
|
589 |
|
590 | ### exportAllDeclaration
|
591 | ```javascript
|
592 | t.exportAllDeclaration(source)
|
593 | ```
|
594 |
|
595 | See also `t.isExportAllDeclaration(node, opts)` and `t.assertExportAllDeclaration(node, opts)`.
|
596 |
|
597 | Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration`
|
598 |
|
599 | - `source`: `StringLiteral` (required)
|
600 |
|
601 | ---
|
602 |
|
603 | ### exportDefaultDeclaration
|
604 | ```javascript
|
605 | t.exportDefaultDeclaration(declaration)
|
606 | ```
|
607 |
|
608 | See also `t.isExportDefaultDeclaration(node, opts)` and `t.assertExportDefaultDeclaration(node, opts)`.
|
609 |
|
610 | Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration`
|
611 |
|
612 | - `declaration`: `FunctionDeclaration | ClassDeclaration | Expression` (required)
|
613 |
|
614 | ---
|
615 |
|
616 | ### exportDefaultSpecifier
|
617 | ```javascript
|
618 | t.exportDefaultSpecifier(exported)
|
619 | ```
|
620 |
|
621 | See also `t.isExportDefaultSpecifier(node, opts)` and `t.assertExportDefaultSpecifier(node, opts)`.
|
622 |
|
623 | Aliases: `ModuleSpecifier`
|
624 |
|
625 | - `exported`: `Identifier` (required)
|
626 |
|
627 | ---
|
628 |
|
629 | ### exportNamedDeclaration
|
630 | ```javascript
|
631 | t.exportNamedDeclaration(declaration, specifiers, source)
|
632 | ```
|
633 |
|
634 | See also `t.isExportNamedDeclaration(node, opts)` and `t.assertExportNamedDeclaration(node, opts)`.
|
635 |
|
636 | Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration`
|
637 |
|
638 | - `declaration`: `Declaration` (default: `null`)
|
639 | - `specifiers`: `Array<ExportSpecifier>` (required)
|
640 | - `source`: `StringLiteral` (default: `null`)
|
641 |
|
642 | ---
|
643 |
|
644 | ### exportNamespaceSpecifier
|
645 | ```javascript
|
646 | t.exportNamespaceSpecifier(exported)
|
647 | ```
|
648 |
|
649 | See also `t.isExportNamespaceSpecifier(node, opts)` and `t.assertExportNamespaceSpecifier(node, opts)`.
|
650 |
|
651 | Aliases: `ModuleSpecifier`
|
652 |
|
653 | - `exported`: `Identifier` (required)
|
654 |
|
655 | ---
|
656 |
|
657 | ### exportSpecifier
|
658 | ```javascript
|
659 | t.exportSpecifier(local, exported)
|
660 | ```
|
661 |
|
662 | See also `t.isExportSpecifier(node, opts)` and `t.assertExportSpecifier(node, opts)`.
|
663 |
|
664 | Aliases: `ModuleSpecifier`
|
665 |
|
666 | - `local`: `Identifier` (required)
|
667 | - `exported`: `Identifier` (required)
|
668 |
|
669 | ---
|
670 |
|
671 | ### expressionStatement
|
672 | ```javascript
|
673 | t.expressionStatement(expression)
|
674 | ```
|
675 |
|
676 | See also `t.isExpressionStatement(node, opts)` and `t.assertExpressionStatement(node, opts)`.
|
677 |
|
678 | Aliases: `Statement`, `ExpressionWrapper`
|
679 |
|
680 | - `expression`: `Expression` (required)
|
681 |
|
682 | ---
|
683 |
|
684 | ### file
|
685 | ```javascript
|
686 | t.file(program, comments, tokens)
|
687 | ```
|
688 |
|
689 | See also `t.isFile(node, opts)` and `t.assertFile(node, opts)`.
|
690 |
|
691 | - `program`: `Program` (required)
|
692 | - `comments` (required)
|
693 | - `tokens` (required)
|
694 |
|
695 | ---
|
696 |
|
697 | ### forInStatement
|
698 | ```javascript
|
699 | t.forInStatement(left, right, body)
|
700 | ```
|
701 |
|
702 | See also `t.isForInStatement(node, opts)` and `t.assertForInStatement(node, opts)`.
|
703 |
|
704 | Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement`
|
705 |
|
706 | - `left`: `VariableDeclaration | LVal` (required)
|
707 | - `right`: `Expression` (required)
|
708 | - `body`: `Statement` (required)
|
709 |
|
710 | ---
|
711 |
|
712 | ### forOfStatement
|
713 | ```javascript
|
714 | t.forOfStatement(left, right, body)
|
715 | ```
|
716 |
|
717 | See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`.
|
718 |
|
719 | Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement`
|
720 |
|
721 | - `left`: `VariableDeclaration | LVal` (required)
|
722 | - `right`: `Expression` (required)
|
723 | - `body`: `Statement` (required)
|
724 | - `await`: `boolean` (default: `false`)
|
725 |
|
726 | ---
|
727 |
|
728 | ### forStatement
|
729 | ```javascript
|
730 | t.forStatement(init, test, update, body)
|
731 | ```
|
732 |
|
733 | See also `t.isForStatement(node, opts)` and `t.assertForStatement(node, opts)`.
|
734 |
|
735 | Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`
|
736 |
|
737 | - `init`: `VariableDeclaration | Expression` (default: `null`)
|
738 | - `test`: `Expression` (default: `null`)
|
739 | - `update`: `Expression` (default: `null`)
|
740 | - `body`: `Statement` (required)
|
741 |
|
742 | ---
|
743 |
|
744 | ### functionDeclaration
|
745 | ```javascript
|
746 | t.functionDeclaration(id, params, body, generator, async)
|
747 | ```
|
748 |
|
749 | See also `t.isFunctionDeclaration(node, opts)` and `t.assertFunctionDeclaration(node, opts)`.
|
750 |
|
751 | Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Statement`, `Pureish`, `Declaration`
|
752 |
|
753 | - `id`: `Identifier` (required)
|
754 | - `params`: `Array<LVal>` (required)
|
755 | - `body`: `BlockStatement` (required)
|
756 | - `generator`: `boolean` (default: `false`)
|
757 | - `async`: `boolean` (default: `false`)
|
758 | - `returnType` (default: `null`)
|
759 | - `typeParameters` (default: `null`)
|
760 |
|
761 | ---
|
762 |
|
763 | ### functionExpression
|
764 | ```javascript
|
765 | t.functionExpression(id, params, body, generator, async)
|
766 | ```
|
767 |
|
768 | See also `t.isFunctionExpression(node, opts)` and `t.assertFunctionExpression(node, opts)`.
|
769 |
|
770 | Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish`
|
771 |
|
772 | - `id`: `Identifier` (default: `null`)
|
773 | - `params`: `Array<LVal>` (required)
|
774 | - `body`: `BlockStatement` (required)
|
775 | - `generator`: `boolean` (default: `false`)
|
776 | - `async`: `boolean` (default: `false`)
|
777 | - `returnType` (default: `null`)
|
778 | - `typeParameters` (default: `null`)
|
779 |
|
780 | ---
|
781 |
|
782 | ### functionTypeAnnotation
|
783 | ```javascript
|
784 | t.functionTypeAnnotation(typeParameters, params, rest, returnType)
|
785 | ```
|
786 |
|
787 | See also `t.isFunctionTypeAnnotation(node, opts)` and `t.assertFunctionTypeAnnotation(node, opts)`.
|
788 |
|
789 | Aliases: `Flow`
|
790 |
|
791 | - `typeParameters` (required)
|
792 | - `params` (required)
|
793 | - `rest` (required)
|
794 | - `returnType` (required)
|
795 |
|
796 | ---
|
797 |
|
798 | ### functionTypeParam
|
799 | ```javascript
|
800 | t.functionTypeParam(name, typeAnnotation)
|
801 | ```
|
802 |
|
803 | See also `t.isFunctionTypeParam(node, opts)` and `t.assertFunctionTypeParam(node, opts)`.
|
804 |
|
805 | Aliases: `Flow`
|
806 |
|
807 | - `name` (required)
|
808 | - `typeAnnotation` (required)
|
809 |
|
810 | ---
|
811 |
|
812 | ### genericTypeAnnotation
|
813 | ```javascript
|
814 | t.genericTypeAnnotation(id, typeParameters)
|
815 | ```
|
816 |
|
817 | See also `t.isGenericTypeAnnotation(node, opts)` and `t.assertGenericTypeAnnotation(node, opts)`.
|
818 |
|
819 | Aliases: `Flow`
|
820 |
|
821 | - `id` (required)
|
822 | - `typeParameters` (required)
|
823 |
|
824 | ---
|
825 |
|
826 | ### identifier
|
827 | ```javascript
|
828 | t.identifier(name)
|
829 | ```
|
830 |
|
831 | See also `t.isIdentifier(node, opts)` and `t.assertIdentifier(node, opts)`.
|
832 |
|
833 | Aliases: `Expression`, `LVal`
|
834 |
|
835 | - `name``string` (required)
|
836 | - `decorators`: `Array<Decorator>` (default: `null`)
|
837 | - `typeAnnotation` (default: `null`)
|
838 |
|
839 | ---
|
840 |
|
841 | ### ifStatement
|
842 | ```javascript
|
843 | t.ifStatement(test, consequent, alternate)
|
844 | ```
|
845 |
|
846 | See also `t.isIfStatement(node, opts)` and `t.assertIfStatement(node, opts)`.
|
847 |
|
848 | Aliases: `Statement`, `Conditional`
|
849 |
|
850 | - `test`: `Expression` (required)
|
851 | - `consequent`: `Statement` (required)
|
852 | - `alternate`: `Statement` (default: `null`)
|
853 |
|
854 | ---
|
855 |
|
856 | ### import
|
857 | ```javascript
|
858 | t.import()
|
859 | ```
|
860 |
|
861 | See also `t.isImport(node, opts)` and `t.assertImport(node, opts)`.
|
862 |
|
863 | Aliases: `Expression`
|
864 |
|
865 |
|
866 | ---
|
867 |
|
868 | ### importDeclaration
|
869 | ```javascript
|
870 | t.importDeclaration(specifiers, source)
|
871 | ```
|
872 |
|
873 | See also `t.isImportDeclaration(node, opts)` and `t.assertImportDeclaration(node, opts)`.
|
874 |
|
875 | Aliases: `Statement`, `Declaration`, `ModuleDeclaration`
|
876 |
|
877 | - `specifiers`: `Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>` (required)
|
878 | - `source`: `StringLiteral` (required)
|
879 |
|
880 | ---
|
881 |
|
882 | ### importDefaultSpecifier
|
883 | ```javascript
|
884 | t.importDefaultSpecifier(local)
|
885 | ```
|
886 |
|
887 | See also `t.isImportDefaultSpecifier(node, opts)` and `t.assertImportDefaultSpecifier(node, opts)`.
|
888 |
|
889 | Aliases: `ModuleSpecifier`
|
890 |
|
891 | - `local`: `Identifier` (required)
|
892 |
|
893 | ---
|
894 |
|
895 | ### importNamespaceSpecifier
|
896 | ```javascript
|
897 | t.importNamespaceSpecifier(local)
|
898 | ```
|
899 |
|
900 | See also `t.isImportNamespaceSpecifier(node, opts)` and `t.assertImportNamespaceSpecifier(node, opts)`.
|
901 |
|
902 | Aliases: `ModuleSpecifier`
|
903 |
|
904 | - `local`: `Identifier` (required)
|
905 |
|
906 | ---
|
907 |
|
908 | ### importSpecifier
|
909 | ```javascript
|
910 | t.importSpecifier(local, imported)
|
911 | ```
|
912 |
|
913 | See also `t.isImportSpecifier(node, opts)` and `t.assertImportSpecifier(node, opts)`.
|
914 |
|
915 | Aliases: `ModuleSpecifier`
|
916 |
|
917 | - `local`: `Identifier` (required)
|
918 | - `imported`: `Identifier` (required)
|
919 | - `importKind`: `null | 'type' | 'typeof'` (default: `null`)
|
920 |
|
921 | ---
|
922 |
|
923 | ### interfaceDeclaration
|
924 | ```javascript
|
925 | t.interfaceDeclaration(id, typeParameters, extends, body)
|
926 | ```
|
927 |
|
928 | See also `t.isInterfaceDeclaration(node, opts)` and `t.assertInterfaceDeclaration(node, opts)`.
|
929 |
|
930 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
931 |
|
932 | - `id` (required)
|
933 | - `typeParameters` (required)
|
934 | - `extends` (required)
|
935 | - `body` (required)
|
936 |
|
937 | ---
|
938 |
|
939 | ### interfaceExtends
|
940 | ```javascript
|
941 | t.interfaceExtends(id, typeParameters)
|
942 | ```
|
943 |
|
944 | See also `t.isInterfaceExtends(node, opts)` and `t.assertInterfaceExtends(node, opts)`.
|
945 |
|
946 | Aliases: `Flow`
|
947 |
|
948 | - `id` (required)
|
949 | - `typeParameters` (required)
|
950 |
|
951 | ---
|
952 |
|
953 | ### intersectionTypeAnnotation
|
954 | ```javascript
|
955 | t.intersectionTypeAnnotation(types)
|
956 | ```
|
957 |
|
958 | See also `t.isIntersectionTypeAnnotation(node, opts)` and `t.assertIntersectionTypeAnnotation(node, opts)`.
|
959 |
|
960 | Aliases: `Flow`
|
961 |
|
962 | - `types` (required)
|
963 |
|
964 | ---
|
965 |
|
966 | ### jSXAttribute
|
967 | ```javascript
|
968 | t.jSXAttribute(name, value)
|
969 | ```
|
970 |
|
971 | See also `t.isJSXAttribute(node, opts)` and `t.assertJSXAttribute(node, opts)`.
|
972 |
|
973 | Aliases: `JSX`, `Immutable`
|
974 |
|
975 | - `name`: `JSXIdentifier | JSXNamespacedName` (required)
|
976 | - `value`: `JSXElement | StringLiteral | JSXExpressionContainer` (default: `null`)
|
977 |
|
978 | ---
|
979 |
|
980 | ### jSXClosingElement
|
981 | ```javascript
|
982 | t.jSXClosingElement(name)
|
983 | ```
|
984 |
|
985 | See also `t.isJSXClosingElement(node, opts)` and `t.assertJSXClosingElement(node, opts)`.
|
986 |
|
987 | Aliases: `JSX`, `Immutable`
|
988 |
|
989 | - `name`: `JSXIdentifier | JSXMemberExpression` (required)
|
990 |
|
991 | ---
|
992 |
|
993 | ### jSXElement
|
994 | ```javascript
|
995 | t.jSXElement(openingElement, closingElement, children, selfClosing)
|
996 | ```
|
997 |
|
998 | See also `t.isJSXElement(node, opts)` and `t.assertJSXElement(node, opts)`.
|
999 |
|
1000 | Aliases: `JSX`, `Immutable`, `Expression`
|
1001 |
|
1002 | - `openingElement`: `JSXOpeningElement` (required)
|
1003 | - `closingElement`: `JSXClosingElement` (default: `null`)
|
1004 | - `children`: `Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement>` (required)
|
1005 | - `selfClosing` (required)
|
1006 |
|
1007 | ---
|
1008 |
|
1009 | ### jSXEmptyExpression
|
1010 | ```javascript
|
1011 | t.jSXEmptyExpression()
|
1012 | ```
|
1013 |
|
1014 | See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`.
|
1015 |
|
1016 | Aliases: `JSX`, `Expression`
|
1017 |
|
1018 |
|
1019 | ---
|
1020 |
|
1021 | ### jSXExpressionContainer
|
1022 | ```javascript
|
1023 | t.jSXExpressionContainer(expression)
|
1024 | ```
|
1025 |
|
1026 | See also `t.isJSXExpressionContainer(node, opts)` and `t.assertJSXExpressionContainer(node, opts)`.
|
1027 |
|
1028 | Aliases: `JSX`, `Immutable`
|
1029 |
|
1030 | - `expression`: `Expression` (required)
|
1031 |
|
1032 | ---
|
1033 |
|
1034 | ### jSXIdentifier
|
1035 | ```javascript
|
1036 | t.jSXIdentifier(name)
|
1037 | ```
|
1038 |
|
1039 | See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`.
|
1040 |
|
1041 | Aliases: `JSX`, `Expression`
|
1042 |
|
1043 | - `name`: `string` (required)
|
1044 |
|
1045 | ---
|
1046 |
|
1047 | ### jSXMemberExpression
|
1048 | ```javascript
|
1049 | t.jSXMemberExpression(object, property)
|
1050 | ```
|
1051 |
|
1052 | See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`.
|
1053 |
|
1054 | Aliases: `JSX`, `Expression`
|
1055 |
|
1056 | - `object`: `JSXMemberExpression | JSXIdentifier` (required)
|
1057 | - `property`: `JSXIdentifier` (required)
|
1058 |
|
1059 | ---
|
1060 |
|
1061 | ### jSXNamespacedName
|
1062 | ```javascript
|
1063 | t.jSXNamespacedName(namespace, name)
|
1064 | ```
|
1065 |
|
1066 | See also `t.isJSXNamespacedName(node, opts)` and `t.assertJSXNamespacedName(node, opts)`.
|
1067 |
|
1068 | Aliases: `JSX`
|
1069 |
|
1070 | - `namespace`: `JSXIdentifier` (required)
|
1071 | - `name`: `JSXIdentifier` (required)
|
1072 |
|
1073 | ---
|
1074 |
|
1075 | ### jSXOpeningElement
|
1076 | ```javascript
|
1077 | t.jSXOpeningElement(name, attributes, selfClosing)
|
1078 | ```
|
1079 |
|
1080 | See also `t.isJSXOpeningElement(node, opts)` and `t.assertJSXOpeningElement(node, opts)`.
|
1081 |
|
1082 | Aliases: `JSX`, `Immutable`
|
1083 |
|
1084 | - `name`: `JSXIdentifier | JSXMemberExpression` (required)
|
1085 | - `attributes`: `Array<JSXAttribute | JSXSpreadAttribute>` (required)
|
1086 | - `selfClosing`: `boolean` (default: `false`)
|
1087 |
|
1088 | ---
|
1089 |
|
1090 | ### jSXSpreadAttribute
|
1091 | ```javascript
|
1092 | t.jSXSpreadAttribute(argument)
|
1093 | ```
|
1094 |
|
1095 | See also `t.isJSXSpreadAttribute(node, opts)` and `t.assertJSXSpreadAttribute(node, opts)`.
|
1096 |
|
1097 | Aliases: `JSX`
|
1098 |
|
1099 | - `argument`: `Expression` (required)
|
1100 |
|
1101 | ---
|
1102 |
|
1103 | ### jSXSpreadChild
|
1104 | ```javascript
|
1105 | t.jSXSpreadChild(expression)
|
1106 | ```
|
1107 |
|
1108 | See also `t.isJSXSpreadChild(node, opts)` and `t.assertJSXSpreadChild(node, opts)`.
|
1109 |
|
1110 | Aliases: `JSX`, `Immutable`
|
1111 |
|
1112 | - `expression`: `Expression` (required)
|
1113 |
|
1114 | ---
|
1115 |
|
1116 | ### jSXText
|
1117 | ```javascript
|
1118 | t.jSXText(value)
|
1119 | ```
|
1120 |
|
1121 | See also `t.isJSXText(node, opts)` and `t.assertJSXText(node, opts)`.
|
1122 |
|
1123 | Aliases: `JSX`, `Immutable`
|
1124 |
|
1125 | - `value`: `string` (required)
|
1126 |
|
1127 | ---
|
1128 |
|
1129 | ### labeledStatement
|
1130 | ```javascript
|
1131 | t.labeledStatement(label, body)
|
1132 | ```
|
1133 |
|
1134 | See also `t.isLabeledStatement(node, opts)` and `t.assertLabeledStatement(node, opts)`.
|
1135 |
|
1136 | Aliases: `Statement`
|
1137 |
|
1138 | - `label`: `Identifier` (required)
|
1139 | - `body`: `Statement` (required)
|
1140 |
|
1141 | ---
|
1142 |
|
1143 | ### logicalExpression
|
1144 | ```javascript
|
1145 | t.logicalExpression(operator, left, right)
|
1146 | ```
|
1147 |
|
1148 | See also `t.isLogicalExpression(node, opts)` and `t.assertLogicalExpression(node, opts)`.
|
1149 |
|
1150 | Aliases: `Binary`, `Expression`
|
1151 |
|
1152 | - `operator`: `'||' | '&&'` (required)
|
1153 | - `left`: `Expression` (required)
|
1154 | - `right`: `Expression` (required)
|
1155 |
|
1156 | ---
|
1157 |
|
1158 | ### memberExpression
|
1159 | ```javascript
|
1160 | t.memberExpression(object, property, computed)
|
1161 | ```
|
1162 |
|
1163 | See also `t.isMemberExpression(node, opts)` and `t.assertMemberExpression(node, opts)`.
|
1164 |
|
1165 | Aliases: `Expression`, `LVal`
|
1166 |
|
1167 | - `object`: `Expression` (required)
|
1168 | - `property`if computed then `Expression` else `Identifier` (required)
|
1169 | - `computed`: `boolean` (default: `false`)
|
1170 |
|
1171 | ---
|
1172 |
|
1173 | ### metaProperty
|
1174 | ```javascript
|
1175 | t.metaProperty(meta, property)
|
1176 | ```
|
1177 |
|
1178 | See also `t.isMetaProperty(node, opts)` and `t.assertMetaProperty(node, opts)`.
|
1179 |
|
1180 | Aliases: `Expression`
|
1181 |
|
1182 | - `meta`: `string` (required)
|
1183 | - `property`: `string` (required)
|
1184 |
|
1185 | ---
|
1186 |
|
1187 | ### mixedTypeAnnotation
|
1188 | ```javascript
|
1189 | t.mixedTypeAnnotation()
|
1190 | ```
|
1191 |
|
1192 | See also `t.isMixedTypeAnnotation(node, opts)` and `t.assertMixedTypeAnnotation(node, opts)`.
|
1193 |
|
1194 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1195 |
|
1196 |
|
1197 | ---
|
1198 |
|
1199 | ### newExpression
|
1200 | ```javascript
|
1201 | t.newExpression(callee, arguments)
|
1202 | ```
|
1203 |
|
1204 | See also `t.isNewExpression(node, opts)` and `t.assertNewExpression(node, opts)`.
|
1205 |
|
1206 | Aliases: `Expression`
|
1207 |
|
1208 | - `callee`: `Expression` (required)
|
1209 | - `arguments`: `Array<Expression | SpreadElement>` (required)
|
1210 |
|
1211 | ---
|
1212 |
|
1213 | ### noop
|
1214 | ```javascript
|
1215 | t.noop()
|
1216 | ```
|
1217 |
|
1218 | See also `t.isNoop(node, opts)` and `t.assertNoop(node, opts)`.
|
1219 |
|
1220 |
|
1221 | ---
|
1222 |
|
1223 | ### nullLiteral
|
1224 | ```javascript
|
1225 | t.nullLiteral()
|
1226 | ```
|
1227 |
|
1228 | See also `t.isNullLiteral(node, opts)` and `t.assertNullLiteral(node, opts)`.
|
1229 |
|
1230 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
1231 |
|
1232 |
|
1233 | ---
|
1234 |
|
1235 | ### nullLiteralTypeAnnotation
|
1236 | ```javascript
|
1237 | t.nullLiteralTypeAnnotation()
|
1238 | ```
|
1239 |
|
1240 | See also `t.isNullLiteralTypeAnnotation(node, opts)` and `t.assertNullLiteralTypeAnnotation(node, opts)`.
|
1241 |
|
1242 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1243 |
|
1244 |
|
1245 | ---
|
1246 |
|
1247 | ### nullableTypeAnnotation
|
1248 | ```javascript
|
1249 | t.nullableTypeAnnotation(typeAnnotation)
|
1250 | ```
|
1251 |
|
1252 | See also `t.isNullableTypeAnnotation(node, opts)` and `t.assertNullableTypeAnnotation(node, opts)`.
|
1253 |
|
1254 | Aliases: `Flow`
|
1255 |
|
1256 | - `typeAnnotation` (required)
|
1257 |
|
1258 | ---
|
1259 |
|
1260 | ### numberLiteralTypeAnnotation
|
1261 | ```javascript
|
1262 | t.numberLiteralTypeAnnotation()
|
1263 | ```
|
1264 |
|
1265 | See also `t.isNumberLiteralTypeAnnotation(node, opts)` and `t.assertNumberLiteralTypeAnnotation(node, opts)`.
|
1266 |
|
1267 | Aliases: `Flow`
|
1268 |
|
1269 |
|
1270 | ---
|
1271 |
|
1272 | ### numberTypeAnnotation
|
1273 | ```javascript
|
1274 | t.numberTypeAnnotation()
|
1275 | ```
|
1276 |
|
1277 | See also `t.isNumberTypeAnnotation(node, opts)` and `t.assertNumberTypeAnnotation(node, opts)`.
|
1278 |
|
1279 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1280 |
|
1281 |
|
1282 | ---
|
1283 |
|
1284 | ### numericLiteral
|
1285 | ```javascript
|
1286 | t.numericLiteral(value)
|
1287 | ```
|
1288 |
|
1289 | See also `t.isNumericLiteral(node, opts)` and `t.assertNumericLiteral(node, opts)`.
|
1290 |
|
1291 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
1292 |
|
1293 | - `value`: `number` (required)
|
1294 |
|
1295 | ---
|
1296 |
|
1297 | ### objectExpression
|
1298 | ```javascript
|
1299 | t.objectExpression(properties)
|
1300 | ```
|
1301 |
|
1302 | See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, opts)`.
|
1303 |
|
1304 | Aliases: `Expression`
|
1305 |
|
1306 | - `properties`: `Array<ObjectMethod | ObjectProperty | SpreadElement>` (required)
|
1307 |
|
1308 | ---
|
1309 |
|
1310 | ### objectMethod
|
1311 | ```javascript
|
1312 | t.objectMethod(kind, key, params, body, computed)
|
1313 | ```
|
1314 |
|
1315 | See also `t.isObjectMethod(node, opts)` and `t.assertObjectMethod(node, opts)`.
|
1316 |
|
1317 | Aliases: `UserWhitespacable`, `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`, `ObjectMember`
|
1318 |
|
1319 | - `kind`: `"method" | "get" | "set"` (default: `'method'`)
|
1320 | - `key`if computed then `Expression` else `Identifier | Literal` (required)
|
1321 | - `params` (required)
|
1322 | - `body`: `BlockStatement` (required)
|
1323 | - `computed`: `boolean` (default: `false`)
|
1324 | - `async`: `boolean` (default: `false`)
|
1325 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1326 | - `generator`: `boolean` (default: `false`)
|
1327 | - `returnType` (default: `null`)
|
1328 | - `typeParameters` (default: `null`)
|
1329 |
|
1330 | ---
|
1331 |
|
1332 | ### objectPattern
|
1333 | ```javascript
|
1334 | t.objectPattern(properties, typeAnnotation)
|
1335 | ```
|
1336 |
|
1337 | See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)`.
|
1338 |
|
1339 | Aliases: `Pattern`, `LVal`
|
1340 |
|
1341 | - `properties`: `Array<RestElement | Property>` (required)
|
1342 | - `typeAnnotation` (required)
|
1343 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1344 |
|
1345 | ---
|
1346 |
|
1347 | ### objectProperty
|
1348 | ```javascript
|
1349 | t.objectProperty(key, value, computed, shorthand, decorators)
|
1350 | ```
|
1351 |
|
1352 | See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts)`.
|
1353 |
|
1354 | Aliases: `UserWhitespacable`, `Property`, `ObjectMember`
|
1355 |
|
1356 | - `key`if computed then `Expression` else `Identifier | Literal` (required)
|
1357 | - `value`: `Expression` (required)
|
1358 | - `computed`: `boolean` (default: `false`)
|
1359 | - `shorthand`: `boolean` (default: `false`)
|
1360 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1361 |
|
1362 | ---
|
1363 |
|
1364 | ### objectTypeAnnotation
|
1365 | ```javascript
|
1366 | t.objectTypeAnnotation(properties, indexers, callProperties)
|
1367 | ```
|
1368 |
|
1369 | See also `t.isObjectTypeAnnotation(node, opts)` and `t.assertObjectTypeAnnotation(node, opts)`.
|
1370 |
|
1371 | Aliases: `Flow`
|
1372 |
|
1373 | - `properties` (required)
|
1374 | - `indexers` (required)
|
1375 | - `callProperties` (required)
|
1376 |
|
1377 | ---
|
1378 |
|
1379 | ### objectTypeCallProperty
|
1380 | ```javascript
|
1381 | t.objectTypeCallProperty(value)
|
1382 | ```
|
1383 |
|
1384 | See also `t.isObjectTypeCallProperty(node, opts)` and `t.assertObjectTypeCallProperty(node, opts)`.
|
1385 |
|
1386 | Aliases: `Flow`, `UserWhitespacable`
|
1387 |
|
1388 | - `value` (required)
|
1389 |
|
1390 | ---
|
1391 |
|
1392 | ### objectTypeIndexer
|
1393 | ```javascript
|
1394 | t.objectTypeIndexer(id, key, value)
|
1395 | ```
|
1396 |
|
1397 | See also `t.isObjectTypeIndexer(node, opts)` and `t.assertObjectTypeIndexer(node, opts)`.
|
1398 |
|
1399 | Aliases: `Flow`, `UserWhitespacable`
|
1400 |
|
1401 | - `id` (required)
|
1402 | - `key` (required)
|
1403 | - `value` (required)
|
1404 |
|
1405 | ---
|
1406 |
|
1407 | ### objectTypeProperty
|
1408 | ```javascript
|
1409 | t.objectTypeProperty(key, value)
|
1410 | ```
|
1411 |
|
1412 | See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(node, opts)`.
|
1413 |
|
1414 | Aliases: `Flow`, `UserWhitespacable`
|
1415 |
|
1416 | - `key` (required)
|
1417 | - `value` (required)
|
1418 |
|
1419 | ---
|
1420 |
|
1421 | ### parenthesizedExpression
|
1422 | ```javascript
|
1423 | t.parenthesizedExpression(expression)
|
1424 | ```
|
1425 |
|
1426 | See also `t.isParenthesizedExpression(node, opts)` and `t.assertParenthesizedExpression(node, opts)`.
|
1427 |
|
1428 | Aliases: `Expression`, `ExpressionWrapper`
|
1429 |
|
1430 | - `expression`: `Expression` (required)
|
1431 |
|
1432 | ---
|
1433 |
|
1434 | ### program
|
1435 | ```javascript
|
1436 | t.program(body, directives)
|
1437 | ```
|
1438 |
|
1439 | See also `t.isProgram(node, opts)` and `t.assertProgram(node, opts)`.
|
1440 |
|
1441 | Aliases: `Scopable`, `BlockParent`, `Block`, `FunctionParent`
|
1442 |
|
1443 | - `body`: `Array<Statement>` (required)
|
1444 | - `directives`: `Array<Directive>` (default: `[]`)
|
1445 |
|
1446 | ---
|
1447 |
|
1448 | ### qualifiedTypeIdentifier
|
1449 | ```javascript
|
1450 | t.qualifiedTypeIdentifier(id, qualification)
|
1451 | ```
|
1452 |
|
1453 | See also `t.isQualifiedTypeIdentifier(node, opts)` and `t.assertQualifiedTypeIdentifier(node, opts)`.
|
1454 |
|
1455 | Aliases: `Flow`
|
1456 |
|
1457 | - `id` (required)
|
1458 | - `qualification` (required)
|
1459 |
|
1460 | ---
|
1461 |
|
1462 | ### regExpLiteral
|
1463 | ```javascript
|
1464 | t.regExpLiteral(pattern, flags)
|
1465 | ```
|
1466 |
|
1467 | See also `t.isRegExpLiteral(node, opts)` and `t.assertRegExpLiteral(node, opts)`.
|
1468 |
|
1469 | Aliases: `Expression`, `Literal`
|
1470 |
|
1471 | - `pattern`: `string` (required)
|
1472 | - `flags`: `string` (default: `''`)
|
1473 |
|
1474 | ---
|
1475 |
|
1476 | ### restElement
|
1477 | ```javascript
|
1478 | t.restElement(argument, typeAnnotation)
|
1479 | ```
|
1480 |
|
1481 | See also `t.isRestElement(node, opts)` and `t.assertRestElement(node, opts)`.
|
1482 |
|
1483 | Aliases: `LVal`
|
1484 |
|
1485 | - `argument`: `LVal` (required)
|
1486 | - `typeAnnotation` (required)
|
1487 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1488 |
|
1489 | ---
|
1490 |
|
1491 | ### returnStatement
|
1492 | ```javascript
|
1493 | t.returnStatement(argument)
|
1494 | ```
|
1495 |
|
1496 | See also `t.isReturnStatement(node, opts)` and `t.assertReturnStatement(node, opts)`.
|
1497 |
|
1498 | Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
|
1499 |
|
1500 | - `argument`: `Expression` (default: `null`)
|
1501 |
|
1502 | ---
|
1503 |
|
1504 | ### sequenceExpression
|
1505 | ```javascript
|
1506 | t.sequenceExpression(expressions)
|
1507 | ```
|
1508 |
|
1509 | See also `t.isSequenceExpression(node, opts)` and `t.assertSequenceExpression(node, opts)`.
|
1510 |
|
1511 | Aliases: `Expression`
|
1512 |
|
1513 | - `expressions`: `Array<Expression>` (required)
|
1514 |
|
1515 | ---
|
1516 |
|
1517 | ### spreadElement
|
1518 | ```javascript
|
1519 | t.spreadElement(argument)
|
1520 | ```
|
1521 |
|
1522 | See also `t.isSpreadElement(node, opts)` and `t.assertSpreadElement(node, opts)`.
|
1523 |
|
1524 | Aliases: `UnaryLike`
|
1525 |
|
1526 | - `argument`: `Expression` (required)
|
1527 |
|
1528 | ---
|
1529 |
|
1530 | ### stringLiteral
|
1531 | ```javascript
|
1532 | t.stringLiteral(value)
|
1533 | ```
|
1534 |
|
1535 | See also `t.isStringLiteral(node, opts)` and `t.assertStringLiteral(node, opts)`.
|
1536 |
|
1537 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
1538 |
|
1539 | - `value`: `string` (required)
|
1540 |
|
1541 | ---
|
1542 |
|
1543 | ### stringLiteralTypeAnnotation
|
1544 | ```javascript
|
1545 | t.stringLiteralTypeAnnotation()
|
1546 | ```
|
1547 |
|
1548 | See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`.
|
1549 |
|
1550 | Aliases: `Flow`
|
1551 |
|
1552 |
|
1553 | ---
|
1554 |
|
1555 | ### stringTypeAnnotation
|
1556 | ```javascript
|
1557 | t.stringTypeAnnotation()
|
1558 | ```
|
1559 |
|
1560 | See also `t.isStringTypeAnnotation(node, opts)` and `t.assertStringTypeAnnotation(node, opts)`.
|
1561 |
|
1562 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1563 |
|
1564 |
|
1565 | ---
|
1566 |
|
1567 | ### super
|
1568 | ```javascript
|
1569 | t.super()
|
1570 | ```
|
1571 |
|
1572 | See also `t.isSuper(node, opts)` and `t.assertSuper(node, opts)`.
|
1573 |
|
1574 | Aliases: `Expression`
|
1575 |
|
1576 |
|
1577 | ---
|
1578 |
|
1579 | ### switchCase
|
1580 | ```javascript
|
1581 | t.switchCase(test, consequent)
|
1582 | ```
|
1583 |
|
1584 | See also `t.isSwitchCase(node, opts)` and `t.assertSwitchCase(node, opts)`.
|
1585 |
|
1586 | - `test`: `Expression` (default: `null`)
|
1587 | - `consequent`: `Array<Statement>` (required)
|
1588 |
|
1589 | ---
|
1590 |
|
1591 | ### switchStatement
|
1592 | ```javascript
|
1593 | t.switchStatement(discriminant, cases)
|
1594 | ```
|
1595 |
|
1596 | See also `t.isSwitchStatement(node, opts)` and `t.assertSwitchStatement(node, opts)`.
|
1597 |
|
1598 | Aliases: `Statement`, `BlockParent`, `Scopable`
|
1599 |
|
1600 | - `discriminant`: `Expression` (required)
|
1601 | - `cases`: `Array<SwitchCase>` (required)
|
1602 |
|
1603 | ---
|
1604 |
|
1605 | ### taggedTemplateExpression
|
1606 | ```javascript
|
1607 | t.taggedTemplateExpression(tag, quasi)
|
1608 | ```
|
1609 |
|
1610 | See also `t.isTaggedTemplateExpression(node, opts)` and `t.assertTaggedTemplateExpression(node, opts)`.
|
1611 |
|
1612 | Aliases: `Expression`
|
1613 |
|
1614 | - `tag`: `Expression` (required)
|
1615 | - `quasi`: `TemplateLiteral` (required)
|
1616 |
|
1617 | ---
|
1618 |
|
1619 | ### templateElement
|
1620 | ```javascript
|
1621 | t.templateElement(value, tail)
|
1622 | ```
|
1623 |
|
1624 | See also `t.isTemplateElement(node, opts)` and `t.assertTemplateElement(node, opts)`.
|
1625 |
|
1626 | - `value` (required)
|
1627 | - `tail`: `boolean` (default: `false`)
|
1628 |
|
1629 | ---
|
1630 |
|
1631 | ### templateLiteral
|
1632 | ```javascript
|
1633 | t.templateLiteral(quasis, expressions)
|
1634 | ```
|
1635 |
|
1636 | See also `t.isTemplateLiteral(node, opts)` and `t.assertTemplateLiteral(node, opts)`.
|
1637 |
|
1638 | Aliases: `Expression`, `Literal`
|
1639 |
|
1640 | - `quasis`: `Array<TemplateElement>` (required)
|
1641 | - `expressions`: `Array<Expression>` (required)
|
1642 |
|
1643 | ---
|
1644 |
|
1645 | ### thisExpression
|
1646 | ```javascript
|
1647 | t.thisExpression()
|
1648 | ```
|
1649 |
|
1650 | See also `t.isThisExpression(node, opts)` and `t.assertThisExpression(node, opts)`.
|
1651 |
|
1652 | Aliases: `Expression`
|
1653 |
|
1654 |
|
1655 | ---
|
1656 |
|
1657 | ### thisTypeAnnotation
|
1658 | ```javascript
|
1659 | t.thisTypeAnnotation()
|
1660 | ```
|
1661 |
|
1662 | See also `t.isThisTypeAnnotation(node, opts)` and `t.assertThisTypeAnnotation(node, opts)`.
|
1663 |
|
1664 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1665 |
|
1666 |
|
1667 | ---
|
1668 |
|
1669 | ### throwStatement
|
1670 | ```javascript
|
1671 | t.throwStatement(argument)
|
1672 | ```
|
1673 |
|
1674 | See also `t.isThrowStatement(node, opts)` and `t.assertThrowStatement(node, opts)`.
|
1675 |
|
1676 | Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
|
1677 |
|
1678 | - `argument`: `Expression` (required)
|
1679 |
|
1680 | ---
|
1681 |
|
1682 | ### tryStatement
|
1683 | ```javascript
|
1684 | t.tryStatement(block, handler, finalizer)
|
1685 | ```
|
1686 |
|
1687 | See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`.
|
1688 |
|
1689 | Aliases: `Statement`
|
1690 |
|
1691 | - `block` (required)
|
1692 | - `handler` (default: `null`)
|
1693 | - `finalizer`: `BlockStatement` (default: `null`)
|
1694 | - `body`: `BlockStatement` (default: `null`)
|
1695 |
|
1696 | ---
|
1697 |
|
1698 | ### tupleTypeAnnotation
|
1699 | ```javascript
|
1700 | t.tupleTypeAnnotation(types)
|
1701 | ```
|
1702 |
|
1703 | See also `t.isTupleTypeAnnotation(node, opts)` and `t.assertTupleTypeAnnotation(node, opts)`.
|
1704 |
|
1705 | Aliases: `Flow`
|
1706 |
|
1707 | - `types` (required)
|
1708 |
|
1709 | ---
|
1710 |
|
1711 | ### typeAlias
|
1712 | ```javascript
|
1713 | t.typeAlias(id, typeParameters, right)
|
1714 | ```
|
1715 |
|
1716 | See also `t.isTypeAlias(node, opts)` and `t.assertTypeAlias(node, opts)`.
|
1717 |
|
1718 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
1719 |
|
1720 | - `id` (required)
|
1721 | - `typeParameters` (required)
|
1722 | - `right` (required)
|
1723 |
|
1724 | ---
|
1725 |
|
1726 | ### typeAnnotation
|
1727 | ```javascript
|
1728 | t.typeAnnotation(typeAnnotation)
|
1729 | ```
|
1730 |
|
1731 | See also `t.isTypeAnnotation(node, opts)` and `t.assertTypeAnnotation(node, opts)`.
|
1732 |
|
1733 | Aliases: `Flow`
|
1734 |
|
1735 | - `typeAnnotation` (required)
|
1736 |
|
1737 | ---
|
1738 |
|
1739 | ### typeCastExpression
|
1740 | ```javascript
|
1741 | t.typeCastExpression(expression, typeAnnotation)
|
1742 | ```
|
1743 |
|
1744 | See also `t.isTypeCastExpression(node, opts)` and `t.assertTypeCastExpression(node, opts)`.
|
1745 |
|
1746 | Aliases: `Flow`, `ExpressionWrapper`, `Expression`
|
1747 |
|
1748 | - `expression` (required)
|
1749 | - `typeAnnotation` (required)
|
1750 |
|
1751 | ---
|
1752 |
|
1753 | ### typeParameter
|
1754 | ```javascript
|
1755 | t.typeParameter(bound)
|
1756 | ```
|
1757 |
|
1758 | See also `t.isTypeParameter(node, opts)` and `t.assertTypeParameter(node, opts)`.
|
1759 |
|
1760 | Aliases: `Flow`
|
1761 |
|
1762 | - `bound` (required)
|
1763 |
|
1764 | ---
|
1765 |
|
1766 | ### typeParameterDeclaration
|
1767 | ```javascript
|
1768 | t.typeParameterDeclaration(params)
|
1769 | ```
|
1770 |
|
1771 | See also `t.isTypeParameterDeclaration(node, opts)` and `t.assertTypeParameterDeclaration(node, opts)`.
|
1772 |
|
1773 | Aliases: `Flow`
|
1774 |
|
1775 | - `params` (required)
|
1776 |
|
1777 | ---
|
1778 |
|
1779 | ### typeParameterInstantiation
|
1780 | ```javascript
|
1781 | t.typeParameterInstantiation(params)
|
1782 | ```
|
1783 |
|
1784 | See also `t.isTypeParameterInstantiation(node, opts)` and `t.assertTypeParameterInstantiation(node, opts)`.
|
1785 |
|
1786 | Aliases: `Flow`
|
1787 |
|
1788 | - `params` (required)
|
1789 |
|
1790 | ---
|
1791 |
|
1792 | ### typeofTypeAnnotation
|
1793 | ```javascript
|
1794 | t.typeofTypeAnnotation(argument)
|
1795 | ```
|
1796 |
|
1797 | See also `t.isTypeofTypeAnnotation(node, opts)` and `t.assertTypeofTypeAnnotation(node, opts)`.
|
1798 |
|
1799 | Aliases: `Flow`
|
1800 |
|
1801 | - `argument` (required)
|
1802 |
|
1803 | ---
|
1804 |
|
1805 | ### unaryExpression
|
1806 | ```javascript
|
1807 | t.unaryExpression(operator, argument, prefix)
|
1808 | ```
|
1809 |
|
1810 | See also `t.isUnaryExpression(node, opts)` and `t.assertUnaryExpression(node, opts)`.
|
1811 |
|
1812 | Aliases: `UnaryLike`, `Expression`
|
1813 |
|
1814 | - `operator`: `'void' | 'delete' | '!' | '+' | '-' | '++' | '--' | '~' | 'typeof'` (required)
|
1815 | - `argument`: `Expression` (required)
|
1816 | - `prefix`: `boolean` (default: `true`)
|
1817 |
|
1818 | ---
|
1819 |
|
1820 | ### unionTypeAnnotation
|
1821 | ```javascript
|
1822 | t.unionTypeAnnotation(types)
|
1823 | ```
|
1824 |
|
1825 | See also `t.isUnionTypeAnnotation(node, opts)` and `t.assertUnionTypeAnnotation(node, opts)`.
|
1826 |
|
1827 | Aliases: `Flow`
|
1828 |
|
1829 | - `types` (required)
|
1830 |
|
1831 | ---
|
1832 |
|
1833 | ### updateExpression
|
1834 | ```javascript
|
1835 | t.updateExpression(operator, argument, prefix)
|
1836 | ```
|
1837 |
|
1838 | See also `t.isUpdateExpression(node, opts)` and `t.assertUpdateExpression(node, opts)`.
|
1839 |
|
1840 | Aliases: `Expression`
|
1841 |
|
1842 | - `operator`: `'++' | '--'` (required)
|
1843 | - `argument`: `Expression` (required)
|
1844 | - `prefix`: `boolean` (default: `false`)
|
1845 |
|
1846 | ---
|
1847 |
|
1848 | ### variableDeclaration
|
1849 | ```javascript
|
1850 | t.variableDeclaration(kind, declarations)
|
1851 | ```
|
1852 |
|
1853 | See also `t.isVariableDeclaration(node, opts)` and `t.assertVariableDeclaration(node, opts)`.
|
1854 |
|
1855 | Aliases: `Statement`, `Declaration`
|
1856 |
|
1857 | - `kind`: `"var" | "let" | "const"` (required)
|
1858 | - `declarations`: `Array<VariableDeclarator>` (required)
|
1859 |
|
1860 | ---
|
1861 |
|
1862 | ### variableDeclarator
|
1863 | ```javascript
|
1864 | t.variableDeclarator(id, init)
|
1865 | ```
|
1866 |
|
1867 | See also `t.isVariableDeclarator(node, opts)` and `t.assertVariableDeclarator(node, opts)`.
|
1868 |
|
1869 | - `id`: `LVal` (required)
|
1870 | - `init`: `Expression` (default: `null`)
|
1871 |
|
1872 | ---
|
1873 |
|
1874 | ### voidTypeAnnotation
|
1875 | ```javascript
|
1876 | t.voidTypeAnnotation()
|
1877 | ```
|
1878 |
|
1879 | See also `t.isVoidTypeAnnotation(node, opts)` and `t.assertVoidTypeAnnotation(node, opts)`.
|
1880 |
|
1881 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1882 |
|
1883 |
|
1884 | ---
|
1885 |
|
1886 | ### whileStatement
|
1887 | ```javascript
|
1888 | t.whileStatement(test, body)
|
1889 | ```
|
1890 |
|
1891 | See also `t.isWhileStatement(node, opts)` and `t.assertWhileStatement(node, opts)`.
|
1892 |
|
1893 | Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable`
|
1894 |
|
1895 | - `test`: `Expression` (required)
|
1896 | - `body`: `BlockStatement | Statement` (required)
|
1897 |
|
1898 | ---
|
1899 |
|
1900 | ### withStatement
|
1901 | ```javascript
|
1902 | t.withStatement(object, body)
|
1903 | ```
|
1904 |
|
1905 | See also `t.isWithStatement(node, opts)` and `t.assertWithStatement(node, opts)`.
|
1906 |
|
1907 | Aliases: `Statement`
|
1908 |
|
1909 | - `object` (required)
|
1910 | - `body`: `BlockStatement | Statement` (required)
|
1911 |
|
1912 | ---
|
1913 |
|
1914 | ### yieldExpression
|
1915 | ```javascript
|
1916 | t.yieldExpression(argument, delegate)
|
1917 | ```
|
1918 |
|
1919 | See also `t.isYieldExpression(node, opts)` and `t.assertYieldExpression(node, opts)`.
|
1920 |
|
1921 | Aliases: `Expression`, `Terminatorless`
|
1922 |
|
1923 | - `argument`: `Expression` (default: `null`)
|
1924 | - `delegate`: `boolean` (default: `false`)
|
1925 |
|
1926 | ---
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|