UNPKG

30.4 kBMarkdownView Raw
1# babel-types
2
3This module contains methods for building ASTs manually and for checking the types of AST nodes.
4
5## API
6
7<!-- begin generated section -->
8
9### t.anyTypeAnnotation()
10
11See also `t.isAnyTypeAnnotation(node, opts)` and `t.assertAnyTypeAnnotation(node, opts)`.
12
13Aliases: `Flow`, `FlowBaseAnnotation`
14
15
16### t.arrayExpression(elements)
17
18See also `t.isArrayExpression(node, opts)` and `t.assertArrayExpression(node, opts)`.
19
20Aliases: `Expression`
21
22 - `elements`: `array` (required)
23
24### t.arrayPattern(elements, typeAnnotation)
25
26See also `t.isArrayPattern(node, opts)` and `t.assertArrayPattern(node, opts)`.
27
28Aliases: `Pattern`, `LVal`
29
30 - `elements`: `Array<Expression>` (required)
31 - `typeAnnotation` (required)
32
33### t.arrayTypeAnnotation(elementType)
34
35See also `t.isArrayTypeAnnotation(node, opts)` and `t.assertArrayTypeAnnotation(node, opts)`.
36
37Aliases: `Flow`
38
39 - `elementType` (required)
40
41### t.arrowFunctionExpression(params, body, async)
42
43See also `t.isArrowFunctionExpression(node, opts)` and `t.assertArrowFunctionExpression(node, opts)`.
44
45Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish`
46
47 - `params`: `Array<LVal>` (required)
48 - `body`: `BlockStatement | Expression` (required)
49 - `async`: `boolean` (default: `false`)
50
51### t.assignmentExpression(operator, left, right)
52
53See also `t.isAssignmentExpression(node, opts)` and `t.assertAssignmentExpression(node, opts)`.
54
55Aliases: `Expression`
56
57 - `operator`: `string` (required)
58 - `left`: `LVal` (required)
59 - `right`: `Expression` (required)
60
61### t.assignmentPattern(left, right)
62
63See also `t.isAssignmentPattern(node, opts)` and `t.assertAssignmentPattern(node, opts)`.
64
65Aliases: `Pattern`, `LVal`
66
67 - `left`: `Identifier` (required)
68 - `right`: `Expression` (required)
69
70### t.awaitExpression(argument)
71
72See also `t.isAwaitExpression(node, opts)` and `t.assertAwaitExpression(node, opts)`.
73
74Aliases: `Expression`, `Terminatorless`
75
76 - `argument`: `Expression` (required)
77
78### t.binaryExpression(operator, left, right)
79
80See also `t.isBinaryExpression(node, opts)` and `t.assertBinaryExpression(node, opts)`.
81
82Aliases: `Binary`, `Expression`
83
84 - `operator`: `string` (required)
85 - `left`: `Expression` (required)
86 - `right`: `Expression` (required)
87
88### t.bindExpression(object, callee)
89
90See also `t.isBindExpression(node, opts)` and `t.assertBindExpression(node, opts)`.
91
92 - `object` (required)
93 - `callee` (required)
94
95### t.blockStatement(body, directives)
96
97See also `t.isBlockStatement(node, opts)` and `t.assertBlockStatement(node, opts)`.
98
99Aliases: `Scopable`, `BlockParent`, `Block`, `Statement`
100
101 - `body`: `Array<Statement>` (required)
102 - `directives`: `Array<Directive>` (default: `[]`)
103
104### t.booleanLiteral(value)
105
106See also `t.isBooleanLiteral(node, opts)` and `t.assertBooleanLiteral(node, opts)`.
107
108Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
109
110 - `value`: `boolean` (required)
111
112### t.booleanLiteralTypeAnnotation()
113
114See also `t.isBooleanLiteralTypeAnnotation(node, opts)` and `t.assertBooleanLiteralTypeAnnotation(node, opts)`.
115
116Aliases: `Flow`
117
118
119### t.booleanTypeAnnotation()
120
121See also `t.isBooleanTypeAnnotation(node, opts)` and `t.assertBooleanTypeAnnotation(node, opts)`.
122
123Aliases: `Flow`, `FlowBaseAnnotation`
124
125
126### t.breakStatement(label)
127
128See also `t.isBreakStatement(node, opts)` and `t.assertBreakStatement(node, opts)`.
129
130Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
131
132 - `label`: `Identifier` (default: `null`)
133
134### t.callExpression(callee, arguments)
135
136See also `t.isCallExpression(node, opts)` and `t.assertCallExpression(node, opts)`.
137
138Aliases: `Expression`
139
140 - `callee`: `Expression` (required)
141 - `arguments`: `array` (required)
142
143### t.catchClause(param, body)
144
145See also `t.isCatchClause(node, opts)` and `t.assertCatchClause(node, opts)`.
146
147Aliases: `Scopable`
148
149 - `param`: `Identifier` (required)
150 - `body`: `BlockStatement` (required)
151
152### t.classBody(body)
153
154See also `t.isClassBody(node, opts)` and `t.assertClassBody(node, opts)`.
155
156 - `body`: `Array<ClassMethod>` (required)
157
158### t.classDeclaration(id, superClass, body, decorators)
159
160See also `t.isClassDeclaration(node, opts)` and `t.assertClassDeclaration(node, opts)`.
161
162Aliases: `Scopable`, `Class`, `Statement`, `Declaration`, `Pureish`
163
164 - `id`: `Identifier` (required)
165 - `superClass`: `Expression` (default: `null`)
166 - `body`: `ClassBody` (required)
167 - `decorators`: `Array<Decorator>` (required)
168
169### t.classExpression(id, superClass, body, decorators)
170
171See also `t.isClassExpression(node, opts)` and `t.assertClassExpression(node, opts)`.
172
173Aliases: `Scopable`, `Class`, `Expression`, `Pureish`
174
175 - `id`: `Identifier` (default: `null`)
176 - `superClass`: `Expression` (default: `null`)
177 - `body`: `ClassBody` (required)
178 - `decorators`: `Array<Decorator>` (required)
179
180### t.classImplements(id, typeParameters)
181
182See also `t.isClassImplements(node, opts)` and `t.assertClassImplements(node, opts)`.
183
184Aliases: `Flow`
185
186 - `id` (required)
187 - `typeParameters` (required)
188
189### t.classMethod(kind, key, params, body, computed, static)
190
191See also `t.isClassMethod(node, opts)` and `t.assertClassMethod(node, opts)`.
192
193Aliases: `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`
194
195 - `kind`: `"get" | "set" | "method" | "constructor"` (default: `'method'`)
196 - `key`if computed then `Expression` else `Identifier | Literal` (required)
197 - `params`: `Array<LVal>` (required)
198 - `body`: `BlockStatement` (required)
199 - `computed`: `boolean` (default: `false`)
200 - `static`: `boolean` (default: `false`)
201
202### t.classProperty(key, value, typeAnnotation, decorators)
203
204See also `t.isClassProperty(node, opts)` and `t.assertClassProperty(node, opts)`.
205
206Aliases: `Flow`, `Property`
207
208 - `key` (required)
209 - `value` (required)
210 - `typeAnnotation` (required)
211 - `decorators` (required)
212
213### t.conditionalExpression(test, consequent, alternate)
214
215See also `t.isConditionalExpression(node, opts)` and `t.assertConditionalExpression(node, opts)`.
216
217Aliases: `Expression`, `Conditional`
218
219 - `test`: `Expression` (required)
220 - `consequent`: `Expression` (required)
221 - `alternate`: `Expression` (required)
222
223### t.continueStatement(label)
224
225See also `t.isContinueStatement(node, opts)` and `t.assertContinueStatement(node, opts)`.
226
227Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
228
229 - `label`: `Identifier` (default: `null`)
230
231### t.debuggerStatement()
232
233See also `t.isDebuggerStatement(node, opts)` and `t.assertDebuggerStatement(node, opts)`.
234
235Aliases: `Statement`
236
237
238### t.declareClass(id, typeParameters, extends, body)
239
240See also `t.isDeclareClass(node, opts)` and `t.assertDeclareClass(node, opts)`.
241
242Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
243
244 - `id` (required)
245 - `typeParameters` (required)
246 - `extends` (required)
247 - `body` (required)
248
249### t.declareFunction(id)
250
251See also `t.isDeclareFunction(node, opts)` and `t.assertDeclareFunction(node, opts)`.
252
253Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
254
255 - `id` (required)
256
257### t.declareModule(id, body)
258
259See also `t.isDeclareModule(node, opts)` and `t.assertDeclareModule(node, opts)`.
260
261Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
262
263 - `id` (required)
264 - `body` (required)
265
266### t.declareVariable(id)
267
268See also `t.isDeclareVariable(node, opts)` and `t.assertDeclareVariable(node, opts)`.
269
270Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
271
272 - `id` (required)
273
274### t.decorator(expression)
275
276See also `t.isDecorator(node, opts)` and `t.assertDecorator(node, opts)`.
277
278 - `expression`: `Expression` (required)
279
280### t.directive(value)
281
282See also `t.isDirective(node, opts)` and `t.assertDirective(node, opts)`.
283
284 - `value`: `DirectiveLiteral` (required)
285
286### t.directiveLiteral(value)
287
288See also `t.isDirectiveLiteral(node, opts)` and `t.assertDirectiveLiteral(node, opts)`.
289
290 - `value`: `string` (required)
291
292### t.doExpression(body)
293
294See also `t.isDoExpression(node, opts)` and `t.assertDoExpression(node, opts)`.
295
296Aliases: `Expression`
297
298 - `body`: `BlockStatement` (required)
299
300### t.doWhileStatement(test, body)
301
302See also `t.isDoWhileStatement(node, opts)` and `t.assertDoWhileStatement(node, opts)`.
303
304Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable`
305
306 - `test`: `Expression` (required)
307 - `body`: `BlockStatement` (required)
308
309### t.emptyStatement()
310
311See also `t.isEmptyStatement(node, opts)` and `t.assertEmptyStatement(node, opts)`.
312
313Aliases: `Statement`
314
315
316### t.existentialTypeParam()
317
318See also `t.isExistentialTypeParam(node, opts)` and `t.assertExistentialTypeParam(node, opts)`.
319
320Aliases: `Flow`
321
322
323### t.exportAllDeclaration(source)
324
325See also `t.isExportAllDeclaration(node, opts)` and `t.assertExportAllDeclaration(node, opts)`.
326
327Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration`
328
329 - `source` (required)
330
331### t.exportDefaultDeclaration(declaration)
332
333See also `t.isExportDefaultDeclaration(node, opts)` and `t.assertExportDefaultDeclaration(node, opts)`.
334
335Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration`
336
337 - `declaration` (required)
338
339### t.exportDefaultSpecifier(exported)
340
341See also `t.isExportDefaultSpecifier(node, opts)` and `t.assertExportDefaultSpecifier(node, opts)`.
342
343Aliases: `ModuleSpecifier`
344
345 - `exported`: `Identifier` (required)
346
347### t.exportNamedDeclaration(declaration, specifiers, source)
348
349See also `t.isExportNamedDeclaration(node, opts)` and `t.assertExportNamedDeclaration(node, opts)`.
350
351Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration`
352
353 - `declaration` (required)
354 - `specifiers` (required)
355 - `source` (required)
356
357### t.exportNamespaceSpecifier(exported)
358
359See also `t.isExportNamespaceSpecifier(node, opts)` and `t.assertExportNamespaceSpecifier(node, opts)`.
360
361Aliases: `ModuleSpecifier`
362
363 - `exported`: `Identifier` (required)
364
365### t.exportSpecifier(local, exported)
366
367See also `t.isExportSpecifier(node, opts)` and `t.assertExportSpecifier(node, opts)`.
368
369Aliases: `ModuleSpecifier`
370
371 - `local`: `Identifier` (required)
372 - `exported` (required)
373
374### t.expressionStatement(expression)
375
376See also `t.isExpressionStatement(node, opts)` and `t.assertExpressionStatement(node, opts)`.
377
378Aliases: `Statement`, `ExpressionWrapper`
379
380 - `expression`: `Expression` (required)
381
382### t.file(program, comments, tokens)
383
384See also `t.isFile(node, opts)` and `t.assertFile(node, opts)`.
385
386 - `program`: `Program` (required)
387 - `comments` (required)
388 - `tokens` (required)
389
390### t.forInStatement(left, right, body)
391
392See also `t.isForInStatement(node, opts)` and `t.assertForInStatement(node, opts)`.
393
394Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement`
395
396 - `left`: `VariableDeclaration | LVal` (required)
397 - `right`: `Expression` (required)
398 - `body`: `Statement` (required)
399
400### t.forOfStatement(left, right, body)
401
402See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`.
403
404Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement`
405
406 - `left`: `VariableDeclaration | LVal` (required)
407 - `right`: `Expression` (required)
408 - `body`: `Statement` (required)
409
410### t.forStatement(init, test, update, body)
411
412See also `t.isForStatement(node, opts)` and `t.assertForStatement(node, opts)`.
413
414Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`
415
416 - `init`: `VariableDeclaration | Expression` (default: `null`)
417 - `test`: `Expression` (default: `null`)
418 - `update`: `Expression` (default: `null`)
419 - `body`: `Statement` (required)
420
421### t.functionDeclaration(id, params, body, generator, async)
422
423See also `t.isFunctionDeclaration(node, opts)` and `t.assertFunctionDeclaration(node, opts)`.
424
425Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Statement`, `Pureish`, `Declaration`
426
427 - `id`: `Identifier` (required)
428 - `params`: `Array<LVal>` (required)
429 - `body`: `BlockStatement` (required)
430 - `generator`: `boolean` (default: `false`)
431 - `async`: `boolean` (default: `false`)
432
433### t.functionExpression(id, params, body, generator, async)
434
435See also `t.isFunctionExpression(node, opts)` and `t.assertFunctionExpression(node, opts)`.
436
437Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish`
438
439 - `id`: `Identifier` (default: `null`)
440 - `params`: `Array<LVal>` (required)
441 - `body`: `BlockStatement` (required)
442 - `generator`: `boolean` (default: `false`)
443 - `async`: `boolean` (default: `false`)
444
445### t.functionTypeAnnotation(typeParameters, params, rest, returnType)
446
447See also `t.isFunctionTypeAnnotation(node, opts)` and `t.assertFunctionTypeAnnotation(node, opts)`.
448
449Aliases: `Flow`
450
451 - `typeParameters` (required)
452 - `params` (required)
453 - `rest` (required)
454 - `returnType` (required)
455
456### t.functionTypeParam(name, typeAnnotation)
457
458See also `t.isFunctionTypeParam(node, opts)` and `t.assertFunctionTypeParam(node, opts)`.
459
460Aliases: `Flow`
461
462 - `name` (required)
463 - `typeAnnotation` (required)
464
465### t.genericTypeAnnotation(id, typeParameters)
466
467See also `t.isGenericTypeAnnotation(node, opts)` and `t.assertGenericTypeAnnotation(node, opts)`.
468
469Aliases: `Flow`
470
471 - `id` (required)
472 - `typeParameters` (required)
473
474### t.identifier(name)
475
476See also `t.isIdentifier(node, opts)` and `t.assertIdentifier(node, opts)`.
477
478Aliases: `Expression`, `LVal`
479
480 - `name``string` (required)
481
482### t.ifStatement(test, consequent, alternate)
483
484See also `t.isIfStatement(node, opts)` and `t.assertIfStatement(node, opts)`.
485
486Aliases: `Statement`, `Conditional`
487
488 - `test`: `Expression` (required)
489 - `consequent`: `Statement` (default: `null`)
490 - `alternate`: `Statement` (default: `null`)
491
492### t.importDeclaration(specifiers, source)
493
494See also `t.isImportDeclaration(node, opts)` and `t.assertImportDeclaration(node, opts)`.
495
496Aliases: `Statement`, `Declaration`, `ModuleDeclaration`
497
498 - `specifiers`: `Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>` (required)
499 - `source`: `StringLiteral` (required)
500
501### t.importDefaultSpecifier(local)
502
503See also `t.isImportDefaultSpecifier(node, opts)` and `t.assertImportDefaultSpecifier(node, opts)`.
504
505Aliases: `ModuleSpecifier`
506
507 - `local`: `Identifier` (required)
508
509### t.importNamespaceSpecifier(local)
510
511See also `t.isImportNamespaceSpecifier(node, opts)` and `t.assertImportNamespaceSpecifier(node, opts)`.
512
513Aliases: `ModuleSpecifier`
514
515 - `local`: `Identifier` (required)
516
517### t.importSpecifier(local, imported)
518
519See also `t.isImportSpecifier(node, opts)` and `t.assertImportSpecifier(node, opts)`.
520
521Aliases: `ModuleSpecifier`
522
523 - `local`: `Identifier` (required)
524 - `imported`: `Identifier` (required)
525
526### t.interfaceDeclaration(id, typeParameters, extends, body)
527
528See also `t.isInterfaceDeclaration(node, opts)` and `t.assertInterfaceDeclaration(node, opts)`.
529
530Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
531
532 - `id` (required)
533 - `typeParameters` (required)
534 - `extends` (required)
535 - `body` (required)
536
537### t.interfaceExtends(id, typeParameters)
538
539See also `t.isInterfaceExtends(node, opts)` and `t.assertInterfaceExtends(node, opts)`.
540
541Aliases: `Flow`
542
543 - `id` (required)
544 - `typeParameters` (required)
545
546### t.intersectionTypeAnnotation(types)
547
548See also `t.isIntersectionTypeAnnotation(node, opts)` and `t.assertIntersectionTypeAnnotation(node, opts)`.
549
550Aliases: `Flow`
551
552 - `types` (required)
553
554### t.jSXAttribute(name, value)
555
556See also `t.isJSXAttribute(node, opts)` and `t.assertJSXAttribute(node, opts)`.
557
558Aliases: `JSX`, `Immutable`
559
560 - `name`: `JSXIdentifier | JSXMemberExpression` (required)
561 - `value`: `JSXElement | StringLiteral | JSXExpressionContainer` (default: `null`)
562
563### t.jSXClosingElement(name)
564
565See also `t.isJSXClosingElement(node, opts)` and `t.assertJSXClosingElement(node, opts)`.
566
567Aliases: `JSX`, `Immutable`
568
569 - `name`: `JSXIdentifier | JSXMemberExpression` (required)
570
571### t.jSXElement(openingElement, closingElement, children, selfClosing)
572
573See also `t.isJSXElement(node, opts)` and `t.assertJSXElement(node, opts)`.
574
575Aliases: `JSX`, `Immutable`, `Expression`
576
577 - `openingElement`: `JSXOpeningElement` (required)
578 - `closingElement`: `JSXClosingElement` (default: `null`)
579 - `children` (required)
580 - `selfClosing` (required)
581
582### t.jSXEmptyExpression()
583
584See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`.
585
586Aliases: `JSX`, `Expression`
587
588
589### t.jSXExpressionContainer(expression)
590
591See also `t.isJSXExpressionContainer(node, opts)` and `t.assertJSXExpressionContainer(node, opts)`.
592
593Aliases: `JSX`, `Immutable`
594
595 - `expression`: `Expression` (required)
596
597### t.jSXIdentifier(name)
598
599See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`.
600
601Aliases: `JSX`, `Expression`
602
603 - `name`: `string` (required)
604
605### t.jSXMemberExpression(object, property)
606
607See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`.
608
609Aliases: `JSX`, `Expression`
610
611 - `object`: `JSXIdentifier` (required)
612 - `property`: `JSXIdentifier` (required)
613
614### t.jSXNamespacedName(namespace, name)
615
616See also `t.isJSXNamespacedName(node, opts)` and `t.assertJSXNamespacedName(node, opts)`.
617
618Aliases: `JSX`
619
620 - `namespace`: `JSXIdentifier` (required)
621 - `name`: `JSXIdentifier` (required)
622
623### t.jSXOpeningElement(name, attributes, selfClosing)
624
625See also `t.isJSXOpeningElement(node, opts)` and `t.assertJSXOpeningElement(node, opts)`.
626
627Aliases: `JSX`, `Immutable`
628
629 - `name`: `JSXIdentifier | JSXMemberExpression` (required)
630 - `attributes`: `Array<JSXAttribute | JSXSpreadAttribute>` (required)
631 - `selfClosing`: `boolean` (default: `false`)
632
633### t.jSXSpreadAttribute(argument)
634
635See also `t.isJSXSpreadAttribute(node, opts)` and `t.assertJSXSpreadAttribute(node, opts)`.
636
637Aliases: `JSX`
638
639 - `argument`: `Expression` (required)
640
641### t.jSXText(value)
642
643See also `t.isJSXText(node, opts)` and `t.assertJSXText(node, opts)`.
644
645Aliases: `JSX`
646
647 - `value`: `string` (required)
648
649### t.labeledStatement(label, body)
650
651See also `t.isLabeledStatement(node, opts)` and `t.assertLabeledStatement(node, opts)`.
652
653Aliases: `Statement`
654
655 - `label`: `Identifier` (required)
656 - `body`: `Statement` (required)
657
658### t.logicalExpression(operator, left, right)
659
660See also `t.isLogicalExpression(node, opts)` and `t.assertLogicalExpression(node, opts)`.
661
662Aliases: `Binary`, `Expression`
663
664 - `operator` (required)
665 - `left`: `Expression` (required)
666 - `right`: `Expression` (required)
667
668### t.memberExpression(object, property, computed)
669
670See also `t.isMemberExpression(node, opts)` and `t.assertMemberExpression(node, opts)`.
671
672Aliases: `Expression`, `LVal`
673
674 - `object`: `Expression` (required)
675 - `property`if computed then `Expression` else `Identifier` (required)
676 - `computed`: `boolean` (default: `false`)
677
678### t.metaProperty(meta, property)
679
680See also `t.isMetaProperty(node, opts)` and `t.assertMetaProperty(node, opts)`.
681
682Aliases: `Expression`
683
684 - `meta`: `string` (required)
685 - `property`: `string` (required)
686
687### t.mixedTypeAnnotation()
688
689See also `t.isMixedTypeAnnotation(node, opts)` and `t.assertMixedTypeAnnotation(node, opts)`.
690
691Aliases: `Flow`, `FlowBaseAnnotation`
692
693
694### t.newExpression(callee, arguments)
695
696See also `t.isNewExpression(node, opts)` and `t.assertNewExpression(node, opts)`.
697
698Aliases: `Expression`
699
700 - `callee`: `Expression` (required)
701 - `arguments`: `Array<Expression>` (required)
702
703### t.noop()
704
705See also `t.isNoop(node, opts)` and `t.assertNoop(node, opts)`.
706
707
708### t.nullLiteral()
709
710See also `t.isNullLiteral(node, opts)` and `t.assertNullLiteral(node, opts)`.
711
712Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
713
714
715### t.nullableTypeAnnotation(typeAnnotation)
716
717See also `t.isNullableTypeAnnotation(node, opts)` and `t.assertNullableTypeAnnotation(node, opts)`.
718
719Aliases: `Flow`
720
721 - `typeAnnotation` (required)
722
723### t.numberTypeAnnotation()
724
725See also `t.isNumberTypeAnnotation(node, opts)` and `t.assertNumberTypeAnnotation(node, opts)`.
726
727Aliases: `Flow`, `FlowBaseAnnotation`
728
729
730### t.numericLiteral(value)
731
732See also `t.isNumericLiteral(node, opts)` and `t.assertNumericLiteral(node, opts)`.
733
734Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
735
736 - `value`: `number` (required)
737
738### t.numericLiteralTypeAnnotation()
739
740See also `t.isNumericLiteralTypeAnnotation(node, opts)` and `t.assertNumericLiteralTypeAnnotation(node, opts)`.
741
742Aliases: `Flow`
743
744
745### t.objectExpression(properties)
746
747See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, opts)`.
748
749Aliases: `Expression`
750
751 - `properties`: `Array<ObjectMethod | ObjectProperty | SpreadProperty>` (required)
752
753### t.objectMethod(kind, key, params, body, computed)
754
755See also `t.isObjectMethod(node, opts)` and `t.assertObjectMethod(node, opts)`.
756
757Aliases: `UserWhitespacable`, `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`
758
759 - `kind`: `"method" | "get" | "set"` (default: `'method'`)
760 - `key`if computed then `Expression` else `Identifier | Literal` (required)
761 - `params` (required)
762 - `body`: `BlockStatement` (required)
763 - `computed`: `boolean` (default: `false`)
764
765### t.objectPattern(properties, typeAnnotation)
766
767See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)`.
768
769Aliases: `Pattern`, `LVal`
770
771 - `properties`: `Array<RestProperty>` (required)
772 - `typeAnnotation` (required)
773
774### t.objectProperty(key, value, computed, shorthand, decorators)
775
776See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts)`.
777
778Aliases: `UserWhitespacable`, `Property`
779
780 - `key`if computed then `Expression` else `Identifier | Literal` (required)
781 - `value`: `Expression` (required)
782 - `computed`: `boolean` (default: `false`)
783 - `shorthand`: `boolean` (default: `false`)
784 - `decorators`: `Array<Decorator>` (default: `null`)
785
786### t.objectTypeAnnotation(properties, indexers, callProperties)
787
788See also `t.isObjectTypeAnnotation(node, opts)` and `t.assertObjectTypeAnnotation(node, opts)`.
789
790Aliases: `Flow`
791
792 - `properties` (required)
793 - `indexers` (required)
794 - `callProperties` (required)
795
796### t.objectTypeCallProperty(value)
797
798See also `t.isObjectTypeCallProperty(node, opts)` and `t.assertObjectTypeCallProperty(node, opts)`.
799
800Aliases: `Flow`, `UserWhitespacable`
801
802 - `value` (required)
803
804### t.objectTypeIndexer(id, key, value)
805
806See also `t.isObjectTypeIndexer(node, opts)` and `t.assertObjectTypeIndexer(node, opts)`.
807
808Aliases: `Flow`, `UserWhitespacable`
809
810 - `id` (required)
811 - `key` (required)
812 - `value` (required)
813
814### t.objectTypeProperty(key, value)
815
816See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(node, opts)`.
817
818Aliases: `Flow`, `UserWhitespacable`
819
820 - `key` (required)
821 - `value` (required)
822
823### t.parenthesizedExpression(expression)
824
825See also `t.isParenthesizedExpression(node, opts)` and `t.assertParenthesizedExpression(node, opts)`.
826
827Aliases: `Expression`, `ExpressionWrapper`
828
829 - `expression`: `Expression` (required)
830
831### t.program(body, directives)
832
833See also `t.isProgram(node, opts)` and `t.assertProgram(node, opts)`.
834
835Aliases: `Scopable`, `BlockParent`, `Block`, `FunctionParent`
836
837 - `body`: `Array<Statement>` (required)
838 - `directives`: `Array<Directive>` (default: `[]`)
839
840### t.qualifiedTypeIdentifier(id, qualification)
841
842See also `t.isQualifiedTypeIdentifier(node, opts)` and `t.assertQualifiedTypeIdentifier(node, opts)`.
843
844Aliases: `Flow`
845
846 - `id` (required)
847 - `qualification` (required)
848
849### t.regExpLiteral(pattern, flags)
850
851See also `t.isRegExpLiteral(node, opts)` and `t.assertRegExpLiteral(node, opts)`.
852
853Aliases: `Expression`, `Literal`
854
855 - `pattern`: `string` (required)
856 - `flags`: `string` (default: `''`)
857
858### t.restElement(argument, typeAnnotation)
859
860See also `t.isRestElement(node, opts)` and `t.assertRestElement(node, opts)`.
861
862Aliases: `LVal`
863
864 - `argument`: `LVal` (required)
865 - `typeAnnotation` (required)
866
867### t.restProperty(argument)
868
869See also `t.isRestProperty(node, opts)` and `t.assertRestProperty(node, opts)`.
870
871Aliases: `UnaryLike`
872
873 - `argument`: `LVal` (required)
874
875### t.returnStatement(argument)
876
877See also `t.isReturnStatement(node, opts)` and `t.assertReturnStatement(node, opts)`.
878
879Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
880
881 - `argument`: `Expression` (default: `null`)
882
883### t.sequenceExpression(expressions)
884
885See also `t.isSequenceExpression(node, opts)` and `t.assertSequenceExpression(node, opts)`.
886
887Aliases: `Expression`
888
889 - `expressions`: `array` (required)
890
891### t.spreadElement(argument)
892
893See also `t.isSpreadElement(node, opts)` and `t.assertSpreadElement(node, opts)`.
894
895Aliases: `UnaryLike`
896
897 - `argument`: `Expression` (required)
898
899### t.spreadProperty(argument)
900
901See also `t.isSpreadProperty(node, opts)` and `t.assertSpreadProperty(node, opts)`.
902
903Aliases: `UnaryLike`
904
905 - `argument`: `Expression` (required)
906
907### t.stringLiteral(value)
908
909See also `t.isStringLiteral(node, opts)` and `t.assertStringLiteral(node, opts)`.
910
911Aliases: `Expression`, `Pureish`, `Literal`, `Immutable`
912
913 - `value`: `string` (required)
914
915### t.stringLiteralTypeAnnotation()
916
917See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`.
918
919Aliases: `Flow`
920
921
922### t.stringTypeAnnotation()
923
924See also `t.isStringTypeAnnotation(node, opts)` and `t.assertStringTypeAnnotation(node, opts)`.
925
926Aliases: `Flow`, `FlowBaseAnnotation`
927
928
929### t.super()
930
931See also `t.isSuper(node, opts)` and `t.assertSuper(node, opts)`.
932
933Aliases: `Expression`
934
935
936### t.switchCase(test, consequent)
937
938See also `t.isSwitchCase(node, opts)` and `t.assertSwitchCase(node, opts)`.
939
940 - `test` (required)
941 - `consequent` (required)
942
943### t.switchStatement(discriminant, cases)
944
945See also `t.isSwitchStatement(node, opts)` and `t.assertSwitchStatement(node, opts)`.
946
947Aliases: `Statement`, `BlockParent`, `Scopable`
948
949 - `discriminant` (required)
950 - `cases` (required)
951
952### t.taggedTemplateExpression(tag, quasi)
953
954See also `t.isTaggedTemplateExpression(node, opts)` and `t.assertTaggedTemplateExpression(node, opts)`.
955
956Aliases: `Expression`
957
958 - `tag`: `Expression` (required)
959 - `quasi`: `TemplateLiteral` (required)
960
961### t.templateElement(value, tail)
962
963See also `t.isTemplateElement(node, opts)` and `t.assertTemplateElement(node, opts)`.
964
965 - `value` (required)
966 - `tail`: `boolean` (default: `false`)
967
968### t.templateLiteral(quasis, expressions)
969
970See also `t.isTemplateLiteral(node, opts)` and `t.assertTemplateLiteral(node, opts)`.
971
972Aliases: `Expression`, `Literal`
973
974 - `quasis` (required)
975 - `expressions` (required)
976
977### t.thisExpression()
978
979See also `t.isThisExpression(node, opts)` and `t.assertThisExpression(node, opts)`.
980
981Aliases: `Expression`
982
983
984### t.throwStatement(argument)
985
986See also `t.isThrowStatement(node, opts)` and `t.assertThrowStatement(node, opts)`.
987
988Aliases: `Statement`, `Terminatorless`, `CompletionStatement`
989
990 - `argument`: `Expression` (required)
991
992### t.tryStatement(block, handler, finalizer)
993
994See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`.
995
996Aliases: `Statement`
997
998 - `block` (required)
999 - `handler` (default: `null`)
1000 - `finalizer`: `BlockStatement` (default: `null`)
1001
1002### t.tupleTypeAnnotation(types)
1003
1004See also `t.isTupleTypeAnnotation(node, opts)` and `t.assertTupleTypeAnnotation(node, opts)`.
1005
1006Aliases: `Flow`
1007
1008 - `types` (required)
1009
1010### t.typeAlias(id, typeParameters, right)
1011
1012See also `t.isTypeAlias(node, opts)` and `t.assertTypeAlias(node, opts)`.
1013
1014Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration`
1015
1016 - `id` (required)
1017 - `typeParameters` (required)
1018 - `right` (required)
1019
1020### t.typeAnnotation(typeAnnotation)
1021
1022See also `t.isTypeAnnotation(node, opts)` and `t.assertTypeAnnotation(node, opts)`.
1023
1024Aliases: `Flow`
1025
1026 - `typeAnnotation` (required)
1027
1028### t.typeCastExpression(expression, typeAnnotation)
1029
1030See also `t.isTypeCastExpression(node, opts)` and `t.assertTypeCastExpression(node, opts)`.
1031
1032Aliases: `Flow`, `ExpressionWrapper`
1033
1034 - `expression` (required)
1035 - `typeAnnotation` (required)
1036
1037### t.typeParameterDeclaration(params)
1038
1039See also `t.isTypeParameterDeclaration(node, opts)` and `t.assertTypeParameterDeclaration(node, opts)`.
1040
1041Aliases: `Flow`
1042
1043 - `params` (required)
1044
1045### t.typeParameterInstantiation(params)
1046
1047See also `t.isTypeParameterInstantiation(node, opts)` and `t.assertTypeParameterInstantiation(node, opts)`.
1048
1049Aliases: `Flow`
1050
1051 - `params` (required)
1052
1053### t.typeofTypeAnnotation(argument)
1054
1055See also `t.isTypeofTypeAnnotation(node, opts)` and `t.assertTypeofTypeAnnotation(node, opts)`.
1056
1057Aliases: `Flow`
1058
1059 - `argument` (required)
1060
1061### t.unaryExpression(operator, argument, prefix)
1062
1063See also `t.isUnaryExpression(node, opts)` and `t.assertUnaryExpression(node, opts)`.
1064
1065Aliases: `UnaryLike`, `Expression`
1066
1067 - `operator` (required)
1068 - `argument`: `Expression` (required)
1069 - `prefix`: `boolean` (default: `false`)
1070
1071### t.unionTypeAnnotation(types)
1072
1073See also `t.isUnionTypeAnnotation(node, opts)` and `t.assertUnionTypeAnnotation(node, opts)`.
1074
1075Aliases: `Flow`
1076
1077 - `types` (required)
1078
1079### t.updateExpression(operator, argument, prefix)
1080
1081See also `t.isUpdateExpression(node, opts)` and `t.assertUpdateExpression(node, opts)`.
1082
1083Aliases: `Expression`
1084
1085 - `operator` (required)
1086 - `argument`: `Expression` (required)
1087 - `prefix`: `boolean` (default: `false`)
1088
1089### t.variableDeclaration(kind, declarations)
1090
1091See also `t.isVariableDeclaration(node, opts)` and `t.assertVariableDeclaration(node, opts)`.
1092
1093Aliases: `Statement`, `Declaration`
1094
1095 - `kind`: `"var" | "let" | "const"` (required)
1096 - `declarations`: `Array<VariableDeclarator>` (required)
1097
1098### t.variableDeclarator(id, init)
1099
1100See also `t.isVariableDeclarator(node, opts)` and `t.assertVariableDeclarator(node, opts)`.
1101
1102 - `id`: `LVal` (required)
1103 - `init`: `Expression` (default: `null`)
1104
1105### t.voidTypeAnnotation()
1106
1107See also `t.isVoidTypeAnnotation(node, opts)` and `t.assertVoidTypeAnnotation(node, opts)`.
1108
1109Aliases: `Flow`, `FlowBaseAnnotation`
1110
1111
1112### t.whileStatement(test, body)
1113
1114See also `t.isWhileStatement(node, opts)` and `t.assertWhileStatement(node, opts)`.
1115
1116Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable`
1117
1118 - `test`: `Expression` (required)
1119 - `body`: `BlockStatement | Statement` (required)
1120
1121### t.withStatement(object, body)
1122
1123See also `t.isWithStatement(node, opts)` and `t.assertWithStatement(node, opts)`.
1124
1125Aliases: `Statement`
1126
1127 - `object` (required)
1128 - `body`: `BlockStatement` (required)
1129
1130### t.yieldExpression(argument, delegate)
1131
1132See also `t.isYieldExpression(node, opts)` and `t.assertYieldExpression(node, opts)`.
1133
1134Aliases: `Expression`, `Terminatorless`
1135
1136 - `argument`: `Expression` (default: `null`)
1137 - `delegate`: `boolean` (default: `false`)
1138
1139
1140<!-- end generated section -->
1141