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 | ### existentialTypeParam
|
579 | ```javascript
|
580 | t.existentialTypeParam()
|
581 | ```
|
582 |
|
583 | See also `t.isExistentialTypeParam(node, opts)` and `t.assertExistentialTypeParam(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 | ### forAwaitStatement
|
698 | ```javascript
|
699 | t.forAwaitStatement(left, right, body)
|
700 | ```
|
701 |
|
702 | See also `t.isForAwaitStatement(node, opts)` and `t.assertForAwaitStatement(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 | ### forInStatement
|
713 | ```javascript
|
714 | t.forInStatement(left, right, body)
|
715 | ```
|
716 |
|
717 | See also `t.isForInStatement(node, opts)` and `t.assertForInStatement(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 |
|
725 | ---
|
726 |
|
727 | ### forOfStatement
|
728 | ```javascript
|
729 | t.forOfStatement(left, right, body)
|
730 | ```
|
731 |
|
732 | See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`.
|
733 |
|
734 | Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement`
|
735 |
|
736 | - `left`: `VariableDeclaration | LVal` (required)
|
737 | - `right`: `Expression` (required)
|
738 | - `body`: `Statement` (required)
|
739 |
|
740 | ---
|
741 |
|
742 | ### forStatement
|
743 | ```javascript
|
744 | t.forStatement(init, test, update, body)
|
745 | ```
|
746 |
|
747 | See also `t.isForStatement(node, opts)` and `t.assertForStatement(node, opts)`.
|
748 |
|
749 | Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`
|
750 |
|
751 | - `init`: `VariableDeclaration | Expression` (default: `null`)
|
752 | - `test`: `Expression` (default: `null`)
|
753 | - `update`: `Expression` (default: `null`)
|
754 | - `body`: `Statement` (required)
|
755 |
|
756 | ---
|
757 |
|
758 | ### functionDeclaration
|
759 | ```javascript
|
760 | t.functionDeclaration(id, params, body, generator, async)
|
761 | ```
|
762 |
|
763 | See also `t.isFunctionDeclaration(node, opts)` and `t.assertFunctionDeclaration(node, opts)`.
|
764 |
|
765 | Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Statement`, `Pureish`, `Declaration`
|
766 |
|
767 | - `id`: `Identifier` (required)
|
768 | - `params`: `Array<LVal>` (required)
|
769 | - `body`: `BlockStatement` (required)
|
770 | - `generator`: `boolean` (default: `false`)
|
771 | - `async`: `boolean` (default: `false`)
|
772 | - `returnType` (default: `null`)
|
773 | - `typeParameters` (default: `null`)
|
774 |
|
775 | ---
|
776 |
|
777 | ### functionExpression
|
778 | ```javascript
|
779 | t.functionExpression(id, params, body, generator, async)
|
780 | ```
|
781 |
|
782 | See also `t.isFunctionExpression(node, opts)` and `t.assertFunctionExpression(node, opts)`.
|
783 |
|
784 | Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish`
|
785 |
|
786 | - `id`: `Identifier` (default: `null`)
|
787 | - `params`: `Array<LVal>` (required)
|
788 | - `body`: `BlockStatement` (required)
|
789 | - `generator`: `boolean` (default: `false`)
|
790 | - `async`: `boolean` (default: `false`)
|
791 | - `returnType` (default: `null`)
|
792 | - `typeParameters` (default: `null`)
|
793 |
|
794 | ---
|
795 |
|
796 | ### functionTypeAnnotation
|
797 | ```javascript
|
798 | t.functionTypeAnnotation(typeParameters, params, rest, returnType)
|
799 | ```
|
800 |
|
801 | See also `t.isFunctionTypeAnnotation(node, opts)` and `t.assertFunctionTypeAnnotation(node, opts)`.
|
802 |
|
803 | Aliases: `Flow`
|
804 |
|
805 | - `typeParameters` (required)
|
806 | - `params` (required)
|
807 | - `rest` (required)
|
808 | - `returnType` (required)
|
809 |
|
810 | ---
|
811 |
|
812 | ### functionTypeParam
|
813 | ```javascript
|
814 | t.functionTypeParam(name, typeAnnotation)
|
815 | ```
|
816 |
|
817 | See also `t.isFunctionTypeParam(node, opts)` and `t.assertFunctionTypeParam(node, opts)`.
|
818 |
|
819 | Aliases: `Flow`
|
820 |
|
821 | - `name` (required)
|
822 | - `typeAnnotation` (required)
|
823 |
|
824 | ---
|
825 |
|
826 | ### genericTypeAnnotation
|
827 | ```javascript
|
828 | t.genericTypeAnnotation(id, typeParameters)
|
829 | ```
|
830 |
|
831 | See also `t.isGenericTypeAnnotation(node, opts)` and `t.assertGenericTypeAnnotation(node, opts)`.
|
832 |
|
833 | Aliases: `Flow`
|
834 |
|
835 | - `id` (required)
|
836 | - `typeParameters` (required)
|
837 |
|
838 | ---
|
839 |
|
840 | ### identifier
|
841 | ```javascript
|
842 | t.identifier(name)
|
843 | ```
|
844 |
|
845 | See also `t.isIdentifier(node, opts)` and `t.assertIdentifier(node, opts)`.
|
846 |
|
847 | Aliases: `Expression`, `LVal`
|
848 |
|
849 | - `name``string` (required)
|
850 | - `decorators`: `Array<Decorator>` (default: `null`)
|
851 | - `typeAnnotation` (default: `null`)
|
852 |
|
853 | ---
|
854 |
|
855 | ### ifStatement
|
856 | ```javascript
|
857 | t.ifStatement(test, consequent, alternate)
|
858 | ```
|
859 |
|
860 | See also `t.isIfStatement(node, opts)` and `t.assertIfStatement(node, opts)`.
|
861 |
|
862 | Aliases: `Statement`, `Conditional`
|
863 |
|
864 | - `test`: `Expression` (required)
|
865 | - `consequent`: `Statement` (required)
|
866 | - `alternate`: `Statement` (default: `null`)
|
867 |
|
868 | ---
|
869 |
|
870 | ### import
|
871 | ```javascript
|
872 | t.import()
|
873 | ```
|
874 |
|
875 | See also `t.isImport(node, opts)` and `t.assertImport(node, opts)`.
|
876 |
|
877 | Aliases: `Expression`
|
878 |
|
879 |
|
880 | ---
|
881 |
|
882 | ### importDeclaration
|
883 | ```javascript
|
884 | t.importDeclaration(specifiers, source)
|
885 | ```
|
886 |
|
887 | See also `t.isImportDeclaration(node, opts)` and `t.assertImportDeclaration(node, opts)`.
|
888 |
|
889 | Aliases: `Statement`, `Declaration`, `ModuleDeclaration`
|
890 |
|
891 | - `specifiers`: `Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>` (required)
|
892 | - `source`: `StringLiteral` (required)
|
893 |
|
894 | ---
|
895 |
|
896 | ### importDefaultSpecifier
|
897 | ```javascript
|
898 | t.importDefaultSpecifier(local)
|
899 | ```
|
900 |
|
901 | See also `t.isImportDefaultSpecifier(node, opts)` and `t.assertImportDefaultSpecifier(node, opts)`.
|
902 |
|
903 | Aliases: `ModuleSpecifier`
|
904 |
|
905 | - `local`: `Identifier` (required)
|
906 |
|
907 | ---
|
908 |
|
909 | ### importNamespaceSpecifier
|
910 | ```javascript
|
911 | t.importNamespaceSpecifier(local)
|
912 | ```
|
913 |
|
914 | See also `t.isImportNamespaceSpecifier(node, opts)` and `t.assertImportNamespaceSpecifier(node, opts)`.
|
915 |
|
916 | Aliases: `ModuleSpecifier`
|
917 |
|
918 | - `local`: `Identifier` (required)
|
919 |
|
920 | ---
|
921 |
|
922 | ### importSpecifier
|
923 | ```javascript
|
924 | t.importSpecifier(local, imported)
|
925 | ```
|
926 |
|
927 | See also `t.isImportSpecifier(node, opts)` and `t.assertImportSpecifier(node, opts)`.
|
928 |
|
929 | Aliases: `ModuleSpecifier`
|
930 |
|
931 | - `local`: `Identifier` (required)
|
932 | - `imported`: `Identifier` (required)
|
933 |
|
934 | ---
|
935 |
|
936 | ### interfaceDeclaration
|
937 | ```javascript
|
938 | t.interfaceDeclaration(id, typeParameters, extends, body)
|
939 | ```
|
940 |
|
941 | See also `t.isInterfaceDeclaration(node, opts)` and `t.assertInterfaceDeclaration(node, opts)`.
|
942 |
|
943 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
944 |
|
945 | - `id` (required)
|
946 | - `typeParameters` (required)
|
947 | - `extends` (required)
|
948 | - `body` (required)
|
949 |
|
950 | ---
|
951 |
|
952 | ### interfaceExtends
|
953 | ```javascript
|
954 | t.interfaceExtends(id, typeParameters)
|
955 | ```
|
956 |
|
957 | See also `t.isInterfaceExtends(node, opts)` and `t.assertInterfaceExtends(node, opts)`.
|
958 |
|
959 | Aliases: `Flow`
|
960 |
|
961 | - `id` (required)
|
962 | - `typeParameters` (required)
|
963 |
|
964 | ---
|
965 |
|
966 | ### intersectionTypeAnnotation
|
967 | ```javascript
|
968 | t.intersectionTypeAnnotation(types)
|
969 | ```
|
970 |
|
971 | See also `t.isIntersectionTypeAnnotation(node, opts)` and `t.assertIntersectionTypeAnnotation(node, opts)`.
|
972 |
|
973 | Aliases: `Flow`
|
974 |
|
975 | - `types` (required)
|
976 |
|
977 | ---
|
978 |
|
979 | ### jSXAttribute
|
980 | ```javascript
|
981 | t.jSXAttribute(name, value)
|
982 | ```
|
983 |
|
984 | See also `t.isJSXAttribute(node, opts)` and `t.assertJSXAttribute(node, opts)`.
|
985 |
|
986 | Aliases: `JSX`, `Immutable`
|
987 |
|
988 | - `name`: `JSXIdentifier | JSXNamespacedName` (required)
|
989 | - `value`: `JSXElement | StringLiteral | JSXExpressionContainer` (default: `null`)
|
990 |
|
991 | ---
|
992 |
|
993 | ### jSXClosingElement
|
994 | ```javascript
|
995 | t.jSXClosingElement(name)
|
996 | ```
|
997 |
|
998 | See also `t.isJSXClosingElement(node, opts)` and `t.assertJSXClosingElement(node, opts)`.
|
999 |
|
1000 | Aliases: `JSX`, `Immutable`
|
1001 |
|
1002 | - `name`: `JSXIdentifier | JSXMemberExpression` (required)
|
1003 |
|
1004 | ---
|
1005 |
|
1006 | ### jSXElement
|
1007 | ```javascript
|
1008 | t.jSXElement(openingElement, closingElement, children, selfClosing)
|
1009 | ```
|
1010 |
|
1011 | See also `t.isJSXElement(node, opts)` and `t.assertJSXElement(node, opts)`.
|
1012 |
|
1013 | Aliases: `JSX`, `Immutable`, `Expression`
|
1014 |
|
1015 | - `openingElement`: `JSXOpeningElement` (required)
|
1016 | - `closingElement`: `JSXClosingElement` (default: `null`)
|
1017 | - `children`: `Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement>` (required)
|
1018 | - `selfClosing` (required)
|
1019 |
|
1020 | ---
|
1021 |
|
1022 | ### jSXEmptyExpression
|
1023 | ```javascript
|
1024 | t.jSXEmptyExpression()
|
1025 | ```
|
1026 |
|
1027 | See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`.
|
1028 |
|
1029 | Aliases: `JSX`, `Expression`
|
1030 |
|
1031 |
|
1032 | ---
|
1033 |
|
1034 | ### jSXExpressionContainer
|
1035 | ```javascript
|
1036 | t.jSXExpressionContainer(expression)
|
1037 | ```
|
1038 |
|
1039 | See also `t.isJSXExpressionContainer(node, opts)` and `t.assertJSXExpressionContainer(node, opts)`.
|
1040 |
|
1041 | Aliases: `JSX`, `Immutable`
|
1042 |
|
1043 | - `expression`: `Expression` (required)
|
1044 |
|
1045 | ---
|
1046 |
|
1047 | ### jSXIdentifier
|
1048 | ```javascript
|
1049 | t.jSXIdentifier(name)
|
1050 | ```
|
1051 |
|
1052 | See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`.
|
1053 |
|
1054 | Aliases: `JSX`, `Expression`
|
1055 |
|
1056 | - `name`: `string` (required)
|
1057 |
|
1058 | ---
|
1059 |
|
1060 | ### jSXMemberExpression
|
1061 | ```javascript
|
1062 | t.jSXMemberExpression(object, property)
|
1063 | ```
|
1064 |
|
1065 | See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`.
|
1066 |
|
1067 | Aliases: `JSX`, `Expression`
|
1068 |
|
1069 | - `object`: `JSXMemberExpression | JSXIdentifier` (required)
|
1070 | - `property`: `JSXIdentifier` (required)
|
1071 |
|
1072 | ---
|
1073 |
|
1074 | ### jSXNamespacedName
|
1075 | ```javascript
|
1076 | t.jSXNamespacedName(namespace, name)
|
1077 | ```
|
1078 |
|
1079 | See also `t.isJSXNamespacedName(node, opts)` and `t.assertJSXNamespacedName(node, opts)`.
|
1080 |
|
1081 | Aliases: `JSX`
|
1082 |
|
1083 | - `namespace`: `JSXIdentifier` (required)
|
1084 | - `name`: `JSXIdentifier` (required)
|
1085 |
|
1086 | ---
|
1087 |
|
1088 | ### jSXOpeningElement
|
1089 | ```javascript
|
1090 | t.jSXOpeningElement(name, attributes, selfClosing)
|
1091 | ```
|
1092 |
|
1093 | See also `t.isJSXOpeningElement(node, opts)` and `t.assertJSXOpeningElement(node, opts)`.
|
1094 |
|
1095 | Aliases: `JSX`, `Immutable`
|
1096 |
|
1097 | - `name`: `JSXIdentifier | JSXMemberExpression` (required)
|
1098 | - `attributes`: `Array<JSXAttribute | JSXSpreadAttribute>` (required)
|
1099 | - `selfClosing`: `boolean` (default: `false`)
|
1100 |
|
1101 | ---
|
1102 |
|
1103 | ### jSXSpreadAttribute
|
1104 | ```javascript
|
1105 | t.jSXSpreadAttribute(argument)
|
1106 | ```
|
1107 |
|
1108 | See also `t.isJSXSpreadAttribute(node, opts)` and `t.assertJSXSpreadAttribute(node, opts)`.
|
1109 |
|
1110 | Aliases: `JSX`
|
1111 |
|
1112 | - `argument`: `Expression` (required)
|
1113 |
|
1114 | ---
|
1115 |
|
1116 | ### jSXSpreadChild
|
1117 | ```javascript
|
1118 | t.jSXSpreadChild(expression)
|
1119 | ```
|
1120 |
|
1121 | See also `t.isJSXSpreadChild(node, opts)` and `t.assertJSXSpreadChild(node, opts)`.
|
1122 |
|
1123 | Aliases: `JSX`, `Immutable`
|
1124 |
|
1125 | - `expression`: `Expression` (required)
|
1126 |
|
1127 | ---
|
1128 |
|
1129 | ### jSXText
|
1130 | ```javascript
|
1131 | t.jSXText(value)
|
1132 | ```
|
1133 |
|
1134 | See also `t.isJSXText(node, opts)` and `t.assertJSXText(node, opts)`.
|
1135 |
|
1136 | Aliases: `JSX`, `Immutable`
|
1137 |
|
1138 | - `value`: `string` (required)
|
1139 |
|
1140 | ---
|
1141 |
|
1142 | ### labeledStatement
|
1143 | ```javascript
|
1144 | t.labeledStatement(label, body)
|
1145 | ```
|
1146 |
|
1147 | See also `t.isLabeledStatement(node, opts)` and `t.assertLabeledStatement(node, opts)`.
|
1148 |
|
1149 | Aliases: `Statement`
|
1150 |
|
1151 | - `label`: `Identifier` (required)
|
1152 | - `body`: `Statement` (required)
|
1153 |
|
1154 | ---
|
1155 |
|
1156 | ### logicalExpression
|
1157 | ```javascript
|
1158 | t.logicalExpression(operator, left, right)
|
1159 | ```
|
1160 |
|
1161 | See also `t.isLogicalExpression(node, opts)` and `t.assertLogicalExpression(node, opts)`.
|
1162 |
|
1163 | Aliases: `Binary`, `Expression`
|
1164 |
|
1165 | - `operator`: `'||' | '&&'` (required)
|
1166 | - `left`: `Expression` (required)
|
1167 | - `right`: `Expression` (required)
|
1168 |
|
1169 | ---
|
1170 |
|
1171 | ### memberExpression
|
1172 | ```javascript
|
1173 | t.memberExpression(object, property, computed)
|
1174 | ```
|
1175 |
|
1176 | See also `t.isMemberExpression(node, opts)` and `t.assertMemberExpression(node, opts)`.
|
1177 |
|
1178 | Aliases: `Expression`, `LVal`
|
1179 |
|
1180 | - `object`: `Expression` (required)
|
1181 | - `property`if computed then `Expression` else `Identifier` (required)
|
1182 | - `computed`: `boolean` (default: `false`)
|
1183 |
|
1184 | ---
|
1185 |
|
1186 | ### metaProperty
|
1187 | ```javascript
|
1188 | t.metaProperty(meta, property)
|
1189 | ```
|
1190 |
|
1191 | See also `t.isMetaProperty(node, opts)` and `t.assertMetaProperty(node, opts)`.
|
1192 |
|
1193 | Aliases: `Expression`
|
1194 |
|
1195 | - `meta`: `string` (required)
|
1196 | - `property`: `string` (required)
|
1197 |
|
1198 | ---
|
1199 |
|
1200 | ### mixedTypeAnnotation
|
1201 | ```javascript
|
1202 | t.mixedTypeAnnotation()
|
1203 | ```
|
1204 |
|
1205 | See also `t.isMixedTypeAnnotation(node, opts)` and `t.assertMixedTypeAnnotation(node, opts)`.
|
1206 |
|
1207 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1208 |
|
1209 |
|
1210 | ---
|
1211 |
|
1212 | ### newExpression
|
1213 | ```javascript
|
1214 | t.newExpression(callee, arguments)
|
1215 | ```
|
1216 |
|
1217 | See also `t.isNewExpression(node, opts)` and `t.assertNewExpression(node, opts)`.
|
1218 |
|
1219 | Aliases: `Expression`
|
1220 |
|
1221 | - `callee`: `Expression` (required)
|
1222 | - `arguments`: `Array<Expression | SpreadElement>` (required)
|
1223 |
|
1224 | ---
|
1225 |
|
1226 | ### noop
|
1227 | ```javascript
|
1228 | t.noop()
|
1229 | ```
|
1230 |
|
1231 | See also `t.isNoop(node, opts)` and `t.assertNoop(node, opts)`.
|
1232 |
|
1233 |
|
1234 | ---
|
1235 |
|
1236 | ### nullLiteral
|
1237 | ```javascript
|
1238 | t.nullLiteral()
|
1239 | ```
|
1240 |
|
1241 | See also `t.isNullLiteral(node, opts)` and `t.assertNullLiteral(node, opts)`.
|
1242 |
|
1243 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
1244 |
|
1245 |
|
1246 | ---
|
1247 |
|
1248 | ### nullLiteralTypeAnnotation
|
1249 | ```javascript
|
1250 | t.nullLiteralTypeAnnotation()
|
1251 | ```
|
1252 |
|
1253 | See also `t.isNullLiteralTypeAnnotation(node, opts)` and `t.assertNullLiteralTypeAnnotation(node, opts)`.
|
1254 |
|
1255 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1256 |
|
1257 |
|
1258 | ---
|
1259 |
|
1260 | ### nullableTypeAnnotation
|
1261 | ```javascript
|
1262 | t.nullableTypeAnnotation(typeAnnotation)
|
1263 | ```
|
1264 |
|
1265 | See also `t.isNullableTypeAnnotation(node, opts)` and `t.assertNullableTypeAnnotation(node, opts)`.
|
1266 |
|
1267 | Aliases: `Flow`
|
1268 |
|
1269 | - `typeAnnotation` (required)
|
1270 |
|
1271 | ---
|
1272 |
|
1273 | ### numberTypeAnnotation
|
1274 | ```javascript
|
1275 | t.numberTypeAnnotation()
|
1276 | ```
|
1277 |
|
1278 | See also `t.isNumberTypeAnnotation(node, opts)` and `t.assertNumberTypeAnnotation(node, opts)`.
|
1279 |
|
1280 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1281 |
|
1282 |
|
1283 | ---
|
1284 |
|
1285 | ### numericLiteral
|
1286 | ```javascript
|
1287 | t.numericLiteral(value)
|
1288 | ```
|
1289 |
|
1290 | See also `t.isNumericLiteral(node, opts)` and `t.assertNumericLiteral(node, opts)`.
|
1291 |
|
1292 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
1293 |
|
1294 | - `value`: `number` (required)
|
1295 |
|
1296 | ---
|
1297 |
|
1298 | ### numericLiteralTypeAnnotation
|
1299 | ```javascript
|
1300 | t.numericLiteralTypeAnnotation()
|
1301 | ```
|
1302 |
|
1303 | See also `t.isNumericLiteralTypeAnnotation(node, opts)` and `t.assertNumericLiteralTypeAnnotation(node, opts)`.
|
1304 |
|
1305 | Aliases: `Flow`
|
1306 |
|
1307 |
|
1308 | ---
|
1309 |
|
1310 | ### objectExpression
|
1311 | ```javascript
|
1312 | t.objectExpression(properties)
|
1313 | ```
|
1314 |
|
1315 | See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, opts)`.
|
1316 |
|
1317 | Aliases: `Expression`
|
1318 |
|
1319 | - `properties`: `Array<ObjectMethod | ObjectProperty | SpreadProperty>` (required)
|
1320 |
|
1321 | ---
|
1322 |
|
1323 | ### objectMethod
|
1324 | ```javascript
|
1325 | t.objectMethod(kind, key, params, body, computed)
|
1326 | ```
|
1327 |
|
1328 | See also `t.isObjectMethod(node, opts)` and `t.assertObjectMethod(node, opts)`.
|
1329 |
|
1330 | Aliases: `UserWhitespacable`, `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`, `ObjectMember`
|
1331 |
|
1332 | - `kind`: `"method" | "get" | "set"` (default: `'method'`)
|
1333 | - `key`if computed then `Expression` else `Identifier | Literal` (required)
|
1334 | - `params` (required)
|
1335 | - `body`: `BlockStatement` (required)
|
1336 | - `computed`: `boolean` (default: `false`)
|
1337 | - `async`: `boolean` (default: `false`)
|
1338 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1339 | - `generator`: `boolean` (default: `false`)
|
1340 | - `returnType` (default: `null`)
|
1341 | - `typeParameters` (default: `null`)
|
1342 |
|
1343 | ---
|
1344 |
|
1345 | ### objectPattern
|
1346 | ```javascript
|
1347 | t.objectPattern(properties, typeAnnotation)
|
1348 | ```
|
1349 |
|
1350 | See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)`.
|
1351 |
|
1352 | Aliases: `Pattern`, `LVal`
|
1353 |
|
1354 | - `properties`: `Array<RestProperty | Property>` (required)
|
1355 | - `typeAnnotation` (required)
|
1356 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1357 |
|
1358 | ---
|
1359 |
|
1360 | ### objectProperty
|
1361 | ```javascript
|
1362 | t.objectProperty(key, value, computed, shorthand, decorators)
|
1363 | ```
|
1364 |
|
1365 | See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts)`.
|
1366 |
|
1367 | Aliases: `UserWhitespacable`, `Property`, `ObjectMember`
|
1368 |
|
1369 | - `key`if computed then `Expression` else `Identifier | Literal` (required)
|
1370 | - `value`: `Expression` (required)
|
1371 | - `computed`: `boolean` (default: `false`)
|
1372 | - `shorthand`: `boolean` (default: `false`)
|
1373 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1374 |
|
1375 | ---
|
1376 |
|
1377 | ### objectTypeAnnotation
|
1378 | ```javascript
|
1379 | t.objectTypeAnnotation(properties, indexers, callProperties)
|
1380 | ```
|
1381 |
|
1382 | See also `t.isObjectTypeAnnotation(node, opts)` and `t.assertObjectTypeAnnotation(node, opts)`.
|
1383 |
|
1384 | Aliases: `Flow`
|
1385 |
|
1386 | - `properties` (required)
|
1387 | - `indexers` (required)
|
1388 | - `callProperties` (required)
|
1389 |
|
1390 | ---
|
1391 |
|
1392 | ### objectTypeCallProperty
|
1393 | ```javascript
|
1394 | t.objectTypeCallProperty(value)
|
1395 | ```
|
1396 |
|
1397 | See also `t.isObjectTypeCallProperty(node, opts)` and `t.assertObjectTypeCallProperty(node, opts)`.
|
1398 |
|
1399 | Aliases: `Flow`, `UserWhitespacable`
|
1400 |
|
1401 | - `value` (required)
|
1402 |
|
1403 | ---
|
1404 |
|
1405 | ### objectTypeIndexer
|
1406 | ```javascript
|
1407 | t.objectTypeIndexer(id, key, value)
|
1408 | ```
|
1409 |
|
1410 | See also `t.isObjectTypeIndexer(node, opts)` and `t.assertObjectTypeIndexer(node, opts)`.
|
1411 |
|
1412 | Aliases: `Flow`, `UserWhitespacable`
|
1413 |
|
1414 | - `id` (required)
|
1415 | - `key` (required)
|
1416 | - `value` (required)
|
1417 |
|
1418 | ---
|
1419 |
|
1420 | ### objectTypeProperty
|
1421 | ```javascript
|
1422 | t.objectTypeProperty(key, value)
|
1423 | ```
|
1424 |
|
1425 | See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(node, opts)`.
|
1426 |
|
1427 | Aliases: `Flow`, `UserWhitespacable`
|
1428 |
|
1429 | - `key` (required)
|
1430 | - `value` (required)
|
1431 |
|
1432 | ---
|
1433 |
|
1434 | ### parenthesizedExpression
|
1435 | ```javascript
|
1436 | t.parenthesizedExpression(expression)
|
1437 | ```
|
1438 |
|
1439 | See also `t.isParenthesizedExpression(node, opts)` and `t.assertParenthesizedExpression(node, opts)`.
|
1440 |
|
1441 | Aliases: `Expression`, `ExpressionWrapper`
|
1442 |
|
1443 | - `expression`: `Expression` (required)
|
1444 |
|
1445 | ---
|
1446 |
|
1447 | ### program
|
1448 | ```javascript
|
1449 | t.program(body, directives)
|
1450 | ```
|
1451 |
|
1452 | See also `t.isProgram(node, opts)` and `t.assertProgram(node, opts)`.
|
1453 |
|
1454 | Aliases: `Scopable`, `BlockParent`, `Block`, `FunctionParent`
|
1455 |
|
1456 | - `body`: `Array<Statement>` (required)
|
1457 | - `directives`: `Array<Directive>` (default: `[]`)
|
1458 |
|
1459 | ---
|
1460 |
|
1461 | ### qualifiedTypeIdentifier
|
1462 | ```javascript
|
1463 | t.qualifiedTypeIdentifier(id, qualification)
|
1464 | ```
|
1465 |
|
1466 | See also `t.isQualifiedTypeIdentifier(node, opts)` and `t.assertQualifiedTypeIdentifier(node, opts)`.
|
1467 |
|
1468 | Aliases: `Flow`
|
1469 |
|
1470 | - `id` (required)
|
1471 | - `qualification` (required)
|
1472 |
|
1473 | ---
|
1474 |
|
1475 | ### regExpLiteral
|
1476 | ```javascript
|
1477 | t.regExpLiteral(pattern, flags)
|
1478 | ```
|
1479 |
|
1480 | See also `t.isRegExpLiteral(node, opts)` and `t.assertRegExpLiteral(node, opts)`.
|
1481 |
|
1482 | Aliases: `Expression`, `Literal`
|
1483 |
|
1484 | - `pattern`: `string` (required)
|
1485 | - `flags`: `string` (default: `''`)
|
1486 |
|
1487 | ---
|
1488 |
|
1489 | ### restElement
|
1490 | ```javascript
|
1491 | t.restElement(argument, typeAnnotation)
|
1492 | ```
|
1493 |
|
1494 | See also `t.isRestElement(node, opts)` and `t.assertRestElement(node, opts)`.
|
1495 |
|
1496 | Aliases: `LVal`
|
1497 |
|
1498 | - `argument`: `LVal` (required)
|
1499 | - `typeAnnotation` (required)
|
1500 | - `decorators`: `Array<Decorator>` (default: `null`)
|
1501 |
|
1502 | ---
|
1503 |
|
1504 | ### restProperty
|
1505 | ```javascript
|
1506 | t.restProperty(argument)
|
1507 | ```
|
1508 |
|
1509 | See also `t.isRestProperty(node, opts)` and `t.assertRestProperty(node, opts)`.
|
1510 |
|
1511 | Aliases: `UnaryLike`
|
1512 |
|
1513 | - `argument`: `LVal` (required)
|
1514 |
|
1515 | ---
|
1516 |
|
1517 | ### returnStatement
|
1518 | ```javascript
|
1519 | t.returnStatement(argument)
|
1520 | ```
|
1521 |
|
1522 | See also `t.isReturnStatement(node, opts)` and `t.assertReturnStatement(node, opts)`.
|
1523 |
|
1524 | Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
|
1525 |
|
1526 | - `argument`: `Expression` (default: `null`)
|
1527 |
|
1528 | ---
|
1529 |
|
1530 | ### sequenceExpression
|
1531 | ```javascript
|
1532 | t.sequenceExpression(expressions)
|
1533 | ```
|
1534 |
|
1535 | See also `t.isSequenceExpression(node, opts)` and `t.assertSequenceExpression(node, opts)`.
|
1536 |
|
1537 | Aliases: `Expression`
|
1538 |
|
1539 | - `expressions`: `Array<Expression>` (required)
|
1540 |
|
1541 | ---
|
1542 |
|
1543 | ### spreadElement
|
1544 | ```javascript
|
1545 | t.spreadElement(argument)
|
1546 | ```
|
1547 |
|
1548 | See also `t.isSpreadElement(node, opts)` and `t.assertSpreadElement(node, opts)`.
|
1549 |
|
1550 | Aliases: `UnaryLike`
|
1551 |
|
1552 | - `argument`: `Expression` (required)
|
1553 |
|
1554 | ---
|
1555 |
|
1556 | ### spreadProperty
|
1557 | ```javascript
|
1558 | t.spreadProperty(argument)
|
1559 | ```
|
1560 |
|
1561 | See also `t.isSpreadProperty(node, opts)` and `t.assertSpreadProperty(node, opts)`.
|
1562 |
|
1563 | Aliases: `UnaryLike`
|
1564 |
|
1565 | - `argument`: `Expression` (required)
|
1566 |
|
1567 | ---
|
1568 |
|
1569 | ### stringLiteral
|
1570 | ```javascript
|
1571 | t.stringLiteral(value)
|
1572 | ```
|
1573 |
|
1574 | See also `t.isStringLiteral(node, opts)` and `t.assertStringLiteral(node, opts)`.
|
1575 |
|
1576 | Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
|
1577 |
|
1578 | - `value`: `string` (required)
|
1579 |
|
1580 | ---
|
1581 |
|
1582 | ### stringLiteralTypeAnnotation
|
1583 | ```javascript
|
1584 | t.stringLiteralTypeAnnotation()
|
1585 | ```
|
1586 |
|
1587 | See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`.
|
1588 |
|
1589 | Aliases: `Flow`
|
1590 |
|
1591 |
|
1592 | ---
|
1593 |
|
1594 | ### stringTypeAnnotation
|
1595 | ```javascript
|
1596 | t.stringTypeAnnotation()
|
1597 | ```
|
1598 |
|
1599 | See also `t.isStringTypeAnnotation(node, opts)` and `t.assertStringTypeAnnotation(node, opts)`.
|
1600 |
|
1601 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1602 |
|
1603 |
|
1604 | ---
|
1605 |
|
1606 | ### super
|
1607 | ```javascript
|
1608 | t.super()
|
1609 | ```
|
1610 |
|
1611 | See also `t.isSuper(node, opts)` and `t.assertSuper(node, opts)`.
|
1612 |
|
1613 | Aliases: `Expression`
|
1614 |
|
1615 |
|
1616 | ---
|
1617 |
|
1618 | ### switchCase
|
1619 | ```javascript
|
1620 | t.switchCase(test, consequent)
|
1621 | ```
|
1622 |
|
1623 | See also `t.isSwitchCase(node, opts)` and `t.assertSwitchCase(node, opts)`.
|
1624 |
|
1625 | - `test`: `Expression` (default: `null`)
|
1626 | - `consequent`: `Array<Statement>` (required)
|
1627 |
|
1628 | ---
|
1629 |
|
1630 | ### switchStatement
|
1631 | ```javascript
|
1632 | t.switchStatement(discriminant, cases)
|
1633 | ```
|
1634 |
|
1635 | See also `t.isSwitchStatement(node, opts)` and `t.assertSwitchStatement(node, opts)`.
|
1636 |
|
1637 | Aliases: `Statement`, `BlockParent`, `Scopable`
|
1638 |
|
1639 | - `discriminant`: `Expression` (required)
|
1640 | - `cases`: `Array<SwitchCase>` (required)
|
1641 |
|
1642 | ---
|
1643 |
|
1644 | ### taggedTemplateExpression
|
1645 | ```javascript
|
1646 | t.taggedTemplateExpression(tag, quasi)
|
1647 | ```
|
1648 |
|
1649 | See also `t.isTaggedTemplateExpression(node, opts)` and `t.assertTaggedTemplateExpression(node, opts)`.
|
1650 |
|
1651 | Aliases: `Expression`
|
1652 |
|
1653 | - `tag`: `Expression` (required)
|
1654 | - `quasi`: `TemplateLiteral` (required)
|
1655 |
|
1656 | ---
|
1657 |
|
1658 | ### templateElement
|
1659 | ```javascript
|
1660 | t.templateElement(value, tail)
|
1661 | ```
|
1662 |
|
1663 | See also `t.isTemplateElement(node, opts)` and `t.assertTemplateElement(node, opts)`.
|
1664 |
|
1665 | - `value` (required)
|
1666 | - `tail`: `boolean` (default: `false`)
|
1667 |
|
1668 | ---
|
1669 |
|
1670 | ### templateLiteral
|
1671 | ```javascript
|
1672 | t.templateLiteral(quasis, expressions)
|
1673 | ```
|
1674 |
|
1675 | See also `t.isTemplateLiteral(node, opts)` and `t.assertTemplateLiteral(node, opts)`.
|
1676 |
|
1677 | Aliases: `Expression`, `Literal`
|
1678 |
|
1679 | - `quasis`: `Array<TemplateElement>` (required)
|
1680 | - `expressions`: `Array<Expression>` (required)
|
1681 |
|
1682 | ---
|
1683 |
|
1684 | ### thisExpression
|
1685 | ```javascript
|
1686 | t.thisExpression()
|
1687 | ```
|
1688 |
|
1689 | See also `t.isThisExpression(node, opts)` and `t.assertThisExpression(node, opts)`.
|
1690 |
|
1691 | Aliases: `Expression`
|
1692 |
|
1693 |
|
1694 | ---
|
1695 |
|
1696 | ### thisTypeAnnotation
|
1697 | ```javascript
|
1698 | t.thisTypeAnnotation()
|
1699 | ```
|
1700 |
|
1701 | See also `t.isThisTypeAnnotation(node, opts)` and `t.assertThisTypeAnnotation(node, opts)`.
|
1702 |
|
1703 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1704 |
|
1705 |
|
1706 | ---
|
1707 |
|
1708 | ### throwStatement
|
1709 | ```javascript
|
1710 | t.throwStatement(argument)
|
1711 | ```
|
1712 |
|
1713 | See also `t.isThrowStatement(node, opts)` and `t.assertThrowStatement(node, opts)`.
|
1714 |
|
1715 | Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
|
1716 |
|
1717 | - `argument`: `Expression` (required)
|
1718 |
|
1719 | ---
|
1720 |
|
1721 | ### tryStatement
|
1722 | ```javascript
|
1723 | t.tryStatement(block, handler, finalizer)
|
1724 | ```
|
1725 |
|
1726 | See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`.
|
1727 |
|
1728 | Aliases: `Statement`
|
1729 |
|
1730 | - `block` (required)
|
1731 | - `handler` (default: `null`)
|
1732 | - `finalizer`: `BlockStatement` (default: `null`)
|
1733 | - `body`: `BlockStatement` (default: `null`)
|
1734 |
|
1735 | ---
|
1736 |
|
1737 | ### tupleTypeAnnotation
|
1738 | ```javascript
|
1739 | t.tupleTypeAnnotation(types)
|
1740 | ```
|
1741 |
|
1742 | See also `t.isTupleTypeAnnotation(node, opts)` and `t.assertTupleTypeAnnotation(node, opts)`.
|
1743 |
|
1744 | Aliases: `Flow`
|
1745 |
|
1746 | - `types` (required)
|
1747 |
|
1748 | ---
|
1749 |
|
1750 | ### typeAlias
|
1751 | ```javascript
|
1752 | t.typeAlias(id, typeParameters, right)
|
1753 | ```
|
1754 |
|
1755 | See also `t.isTypeAlias(node, opts)` and `t.assertTypeAlias(node, opts)`.
|
1756 |
|
1757 | Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
|
1758 |
|
1759 | - `id` (required)
|
1760 | - `typeParameters` (required)
|
1761 | - `right` (required)
|
1762 |
|
1763 | ---
|
1764 |
|
1765 | ### typeAnnotation
|
1766 | ```javascript
|
1767 | t.typeAnnotation(typeAnnotation)
|
1768 | ```
|
1769 |
|
1770 | See also `t.isTypeAnnotation(node, opts)` and `t.assertTypeAnnotation(node, opts)`.
|
1771 |
|
1772 | Aliases: `Flow`
|
1773 |
|
1774 | - `typeAnnotation` (required)
|
1775 |
|
1776 | ---
|
1777 |
|
1778 | ### typeCastExpression
|
1779 | ```javascript
|
1780 | t.typeCastExpression(expression, typeAnnotation)
|
1781 | ```
|
1782 |
|
1783 | See also `t.isTypeCastExpression(node, opts)` and `t.assertTypeCastExpression(node, opts)`.
|
1784 |
|
1785 | Aliases: `Flow`, `ExpressionWrapper`, `Expression`
|
1786 |
|
1787 | - `expression` (required)
|
1788 | - `typeAnnotation` (required)
|
1789 |
|
1790 | ---
|
1791 |
|
1792 | ### typeParameter
|
1793 | ```javascript
|
1794 | t.typeParameter(bound)
|
1795 | ```
|
1796 |
|
1797 | See also `t.isTypeParameter(node, opts)` and `t.assertTypeParameter(node, opts)`.
|
1798 |
|
1799 | Aliases: `Flow`
|
1800 |
|
1801 | - `bound` (required)
|
1802 |
|
1803 | ---
|
1804 |
|
1805 | ### typeParameterDeclaration
|
1806 | ```javascript
|
1807 | t.typeParameterDeclaration(params)
|
1808 | ```
|
1809 |
|
1810 | See also `t.isTypeParameterDeclaration(node, opts)` and `t.assertTypeParameterDeclaration(node, opts)`.
|
1811 |
|
1812 | Aliases: `Flow`
|
1813 |
|
1814 | - `params` (required)
|
1815 |
|
1816 | ---
|
1817 |
|
1818 | ### typeParameterInstantiation
|
1819 | ```javascript
|
1820 | t.typeParameterInstantiation(params)
|
1821 | ```
|
1822 |
|
1823 | See also `t.isTypeParameterInstantiation(node, opts)` and `t.assertTypeParameterInstantiation(node, opts)`.
|
1824 |
|
1825 | Aliases: `Flow`
|
1826 |
|
1827 | - `params` (required)
|
1828 |
|
1829 | ---
|
1830 |
|
1831 | ### typeofTypeAnnotation
|
1832 | ```javascript
|
1833 | t.typeofTypeAnnotation(argument)
|
1834 | ```
|
1835 |
|
1836 | See also `t.isTypeofTypeAnnotation(node, opts)` and `t.assertTypeofTypeAnnotation(node, opts)`.
|
1837 |
|
1838 | Aliases: `Flow`
|
1839 |
|
1840 | - `argument` (required)
|
1841 |
|
1842 | ---
|
1843 |
|
1844 | ### unaryExpression
|
1845 | ```javascript
|
1846 | t.unaryExpression(operator, argument, prefix)
|
1847 | ```
|
1848 |
|
1849 | See also `t.isUnaryExpression(node, opts)` and `t.assertUnaryExpression(node, opts)`.
|
1850 |
|
1851 | Aliases: `UnaryLike`, `Expression`
|
1852 |
|
1853 | - `operator`: `'void' | 'delete' | '!' | '+' | '-' | '++' | '--' | '~' | 'typeof'` (required)
|
1854 | - `argument`: `Expression` (required)
|
1855 | - `prefix`: `boolean` (default: `true`)
|
1856 |
|
1857 | ---
|
1858 |
|
1859 | ### unionTypeAnnotation
|
1860 | ```javascript
|
1861 | t.unionTypeAnnotation(types)
|
1862 | ```
|
1863 |
|
1864 | See also `t.isUnionTypeAnnotation(node, opts)` and `t.assertUnionTypeAnnotation(node, opts)`.
|
1865 |
|
1866 | Aliases: `Flow`
|
1867 |
|
1868 | - `types` (required)
|
1869 |
|
1870 | ---
|
1871 |
|
1872 | ### updateExpression
|
1873 | ```javascript
|
1874 | t.updateExpression(operator, argument, prefix)
|
1875 | ```
|
1876 |
|
1877 | See also `t.isUpdateExpression(node, opts)` and `t.assertUpdateExpression(node, opts)`.
|
1878 |
|
1879 | Aliases: `Expression`
|
1880 |
|
1881 | - `operator`: `'++' | '--'` (required)
|
1882 | - `argument`: `Expression` (required)
|
1883 | - `prefix`: `boolean` (default: `false`)
|
1884 |
|
1885 | ---
|
1886 |
|
1887 | ### variableDeclaration
|
1888 | ```javascript
|
1889 | t.variableDeclaration(kind, declarations)
|
1890 | ```
|
1891 |
|
1892 | See also `t.isVariableDeclaration(node, opts)` and `t.assertVariableDeclaration(node, opts)`.
|
1893 |
|
1894 | Aliases: `Statement`, `Declaration`
|
1895 |
|
1896 | - `kind`: `"var" | "let" | "const"` (required)
|
1897 | - `declarations`: `Array<VariableDeclarator>` (required)
|
1898 |
|
1899 | ---
|
1900 |
|
1901 | ### variableDeclarator
|
1902 | ```javascript
|
1903 | t.variableDeclarator(id, init)
|
1904 | ```
|
1905 |
|
1906 | See also `t.isVariableDeclarator(node, opts)` and `t.assertVariableDeclarator(node, opts)`.
|
1907 |
|
1908 | - `id`: `LVal` (required)
|
1909 | - `init`: `Expression` (default: `null`)
|
1910 |
|
1911 | ---
|
1912 |
|
1913 | ### voidTypeAnnotation
|
1914 | ```javascript
|
1915 | t.voidTypeAnnotation()
|
1916 | ```
|
1917 |
|
1918 | See also `t.isVoidTypeAnnotation(node, opts)` and `t.assertVoidTypeAnnotation(node, opts)`.
|
1919 |
|
1920 | Aliases: `Flow`, `FlowBaseAnnotation`
|
1921 |
|
1922 |
|
1923 | ---
|
1924 |
|
1925 | ### whileStatement
|
1926 | ```javascript
|
1927 | t.whileStatement(test, body)
|
1928 | ```
|
1929 |
|
1930 | See also `t.isWhileStatement(node, opts)` and `t.assertWhileStatement(node, opts)`.
|
1931 |
|
1932 | Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable`
|
1933 |
|
1934 | - `test`: `Expression` (required)
|
1935 | - `body`: `BlockStatement | Statement` (required)
|
1936 |
|
1937 | ---
|
1938 |
|
1939 | ### withStatement
|
1940 | ```javascript
|
1941 | t.withStatement(object, body)
|
1942 | ```
|
1943 |
|
1944 | See also `t.isWithStatement(node, opts)` and `t.assertWithStatement(node, opts)`.
|
1945 |
|
1946 | Aliases: `Statement`
|
1947 |
|
1948 | - `object` (required)
|
1949 | - `body`: `BlockStatement | Statement` (required)
|
1950 |
|
1951 | ---
|
1952 |
|
1953 | ### yieldExpression
|
1954 | ```javascript
|
1955 | t.yieldExpression(argument, delegate)
|
1956 | ```
|
1957 |
|
1958 | See also `t.isYieldExpression(node, opts)` and `t.assertYieldExpression(node, opts)`.
|
1959 |
|
1960 | Aliases: `Expression`, `Terminatorless`
|
1961 |
|
1962 | - `argument`: `Expression` (default: `null`)
|
1963 | - `delegate`: `boolean` (default: `false`)
|
1964 |
|
1965 | ---
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|