Debian Codegraph @

packages/babel-types/src/builders/generated/index.ts

raw
1 /*
2 * This file is auto-generated! Do not modify it directly.
3 * To re-generate run 'make build'
4 */
5 import validateNode from "../validateNode";
6 import type * as t from "../..";
7 export function arrayExpression(
8 elements: Array<null | t.Expression | t.SpreadElement> = [],
9 ): t.ArrayExpression {
10 return validateNode<t.ArrayExpression>({
11 type: "ArrayExpression",
12 elements,
13 });
14 }
15 export function assignmentExpression(
16 operator: string,
17 left: t.LVal,
18 right: t.Expression,
19 ): t.AssignmentExpression {
20 return validateNode<t.AssignmentExpression>({
21 type: "AssignmentExpression",
22 operator,
23 left,
24 right,
25 });
26 }
27 export function binaryExpression(
28 operator:
29 | "+"
30 | "-"
31 | "/"
32 | "%"
33 | "*"
34 | "**"
35 | "&"
36 | "|"
37 | ">>"
38 | ">>>"
39 | "<<"
40 | "^"
41 | "=="
42 | "==="
43 | "!="
44 | "!=="
45 | "in"
46 | "instanceof"
47 | ">"
48 | "<"
49 | ">="
50 | "<="
51 | "|>",
52 left: t.Expression | t.PrivateName,
53 right: t.Expression,
54 ): t.BinaryExpression {
55 return validateNode<t.BinaryExpression>({
56 type: "BinaryExpression",
57 operator,
58 left,
59 right,
60 });
61 }
62 export function interpreterDirective(value: string): t.InterpreterDirective {
63 return validateNode<t.InterpreterDirective>({
64 type: "InterpreterDirective",
65 value,
66 });
67 }
68 export function directive(value: t.DirectiveLiteral): t.Directive {
69 return validateNode<t.Directive>({
70 type: "Directive",
71 value,
72 });
73 }
74 export function directiveLiteral(value: string): t.DirectiveLiteral {
75 return validateNode<t.DirectiveLiteral>({
76 type: "DirectiveLiteral",
77 value,
78 });
79 }
80 export function blockStatement(
81 body: Array<t.Statement>,
82 directives: Array<t.Directive> = [],
83 ): t.BlockStatement {
84 return validateNode<t.BlockStatement>({
85 type: "BlockStatement",
86 body,
87 directives,
88 });
89 }
90 export function breakStatement(
91 label: t.Identifier | null = null,
92 ): t.BreakStatement {
93 return validateNode<t.BreakStatement>({
94 type: "BreakStatement",
95 label,
96 });
97 }
98 export function callExpression(
99 callee: t.Expression | t.Super | t.V8IntrinsicIdentifier,
100 _arguments: Array<
101 t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder
102 >,
103 ): t.CallExpression {
104 return validateNode<t.CallExpression>({
105 type: "CallExpression",
106 callee,
107 arguments: _arguments,
108 });
109 }
110 export function catchClause(
111 param:
112 | t.Identifier
113 | t.ArrayPattern
114 | t.ObjectPattern
115 | null
116 | undefined = null,
117 body: t.BlockStatement,
118 ): t.CatchClause {
119 return validateNode<t.CatchClause>({
120 type: "CatchClause",
121 param,
122 body,
123 });
124 }
125 export function conditionalExpression(
126 test: t.Expression,
127 consequent: t.Expression,
128 alternate: t.Expression,
129 ): t.ConditionalExpression {
130 return validateNode<t.ConditionalExpression>({
131 type: "ConditionalExpression",
132 test,
133 consequent,
134 alternate,
135 });
136 }
137 export function continueStatement(
138 label: t.Identifier | null = null,
139 ): t.ContinueStatement {
140 return validateNode<t.ContinueStatement>({
141 type: "ContinueStatement",
142 label,
143 });
144 }
145 export function debuggerStatement(): t.DebuggerStatement {
146 return {
147 type: "DebuggerStatement",
148 };
149 }
150 export function doWhileStatement(
151 test: t.Expression,
152 body: t.Statement,
153 ): t.DoWhileStatement {
154 return validateNode<t.DoWhileStatement>({
155 type: "DoWhileStatement",
156 test,
157 body,
158 });
159 }
160 export function emptyStatement(): t.EmptyStatement {
161 return {
162 type: "EmptyStatement",
163 };
164 }
165 export function expressionStatement(
166 expression: t.Expression,
167 ): t.ExpressionStatement {
168 return validateNode<t.ExpressionStatement>({
169 type: "ExpressionStatement",
170 expression,
171 });
172 }
173 export function file(
174 program: t.Program,
175 comments: Array<t.CommentBlock | t.CommentLine> | null = null,
176 tokens: Array<any> | null = null,
177 ): t.File {
178 return validateNode<t.File>({
179 type: "File",
180 program,
181 comments,
182 tokens,
183 });
184 }
185 export function forInStatement(
186 left: t.VariableDeclaration | t.LVal,
187 right: t.Expression,
188 body: t.Statement,
189 ): t.ForInStatement {
190 return validateNode<t.ForInStatement>({
191 type: "ForInStatement",
192 left,
193 right,
194 body,
195 });
196 }
197 export function forStatement(
198 init: t.VariableDeclaration | t.Expression | null | undefined = null,
199 test: t.Expression | null | undefined = null,
200 update: t.Expression | null | undefined = null,
201 body: t.Statement,
202 ): t.ForStatement {
203 return validateNode<t.ForStatement>({
204 type: "ForStatement",
205 init,
206 test,
207 update,
208 body,
209 });
210 }
211 export function functionDeclaration(
212 id: t.Identifier | null | undefined = null,
213 params: Array<t.Identifier | t.Pattern | t.RestElement>,
214 body: t.BlockStatement,
215 generator: boolean = false,
216 async: boolean = false,
217 ): t.FunctionDeclaration {
218 return validateNode<t.FunctionDeclaration>({
219 type: "FunctionDeclaration",
220 id,
221 params,
222 body,
223 generator,
224 async,
225 });
226 }
227 export function functionExpression(
228 id: t.Identifier | null | undefined = null,
229 params: Array<t.Identifier | t.Pattern | t.RestElement>,
230 body: t.BlockStatement,
231 generator: boolean = false,
232 async: boolean = false,
233 ): t.FunctionExpression {
234 return validateNode<t.FunctionExpression>({
235 type: "FunctionExpression",
236 id,
237 params,
238 body,
239 generator,
240 async,
241 });
242 }
243 export function identifier(name: string): t.Identifier {
244 return validateNode<t.Identifier>({
245 type: "Identifier",
246 name,
247 });
248 }
249 export function ifStatement(
250 test: t.Expression,
251 consequent: t.Statement,
252 alternate: t.Statement | null = null,
253 ): t.IfStatement {
254 return validateNode<t.IfStatement>({
255 type: "IfStatement",
256 test,
257 consequent,
258 alternate,
259 });
260 }
261 export function labeledStatement(
262 label: t.Identifier,
263 body: t.Statement,
264 ): t.LabeledStatement {
265 return validateNode<t.LabeledStatement>({
266 type: "LabeledStatement",
267 label,
268 body,
269 });
270 }
271 export function stringLiteral(value: string): t.StringLiteral {
272 return validateNode<t.StringLiteral>({
273 type: "StringLiteral",
274 value,
275 });
276 }
277 export function numericLiteral(value: number): t.NumericLiteral {
278 return validateNode<t.NumericLiteral>({
279 type: "NumericLiteral",
280 value,
281 });
282 }
283 export function nullLiteral(): t.NullLiteral {
284 return {
285 type: "NullLiteral",
286 };
287 }
288 export function booleanLiteral(value: boolean): t.BooleanLiteral {
289 return validateNode<t.BooleanLiteral>({
290 type: "BooleanLiteral",
291 value,
292 });
293 }
294 export function regExpLiteral(
295 pattern: string,
296 flags: string = "",
297 ): t.RegExpLiteral {
298 return validateNode<t.RegExpLiteral>({
299 type: "RegExpLiteral",
300 pattern,
301 flags,
302 });
303 }
304 export function logicalExpression(
305 operator: "||" | "&&" | "??",
306 left: t.Expression,
307 right: t.Expression,
308 ): t.LogicalExpression {
309 return validateNode<t.LogicalExpression>({
310 type: "LogicalExpression",
311 operator,
312 left,
313 right,
314 });
315 }
316 export function memberExpression(
317 object: t.Expression | t.Super,
318 property: t.Expression | t.Identifier | t.PrivateName,
319 computed: boolean = false,
320 optional: true | false | null = null,
321 ): t.MemberExpression {
322 return validateNode<t.MemberExpression>({
323 type: "MemberExpression",
324 object,
325 property,
326 computed,
327 optional,
328 });
329 }
330 export function newExpression(
331 callee: t.Expression | t.Super | t.V8IntrinsicIdentifier,
332 _arguments: Array<
333 t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder
334 >,
335 ): t.NewExpression {
336 return validateNode<t.NewExpression>({
337 type: "NewExpression",
338 callee,
339 arguments: _arguments,
340 });
341 }
342 export function program(
343 body: Array<t.Statement>,
344 directives: Array<t.Directive> = [],
345 sourceType: "script" | "module" = "script",
346 interpreter: t.InterpreterDirective | null = null,
347 ): t.Program {
348 return validateNode<t.Program>({
349 type: "Program",
350 body,
351 directives,
352 sourceType,
353 interpreter,
354 sourceFile: null,
355 });
356 }
357 export function objectExpression(
358 properties: Array<t.ObjectMethod | t.ObjectProperty | t.SpreadElement>,
359 ): t.ObjectExpression {
360 return validateNode<t.ObjectExpression>({
361 type: "ObjectExpression",
362 properties,
363 });
364 }
365 export function objectMethod(
366 kind: "method" | "get" | "set" | undefined = "method",
367 key:
368 | t.Expression
369 | t.Identifier
370 | t.StringLiteral
371 | t.NumericLiteral
372 | t.BigIntLiteral,
373 params: Array<t.Identifier | t.Pattern | t.RestElement>,
374 body: t.BlockStatement,
375 computed: boolean = false,
376 generator: boolean = false,
377 async: boolean = false,
378 ): t.ObjectMethod {
379 return validateNode<t.ObjectMethod>({
380 type: "ObjectMethod",
381 kind,
382 key,
383 params,
384 body,
385 computed,
386 generator,
387 async,
388 });
389 }
390 export function objectProperty(
391 key:
392 | t.Expression
393 | t.Identifier
394 | t.StringLiteral
395 | t.NumericLiteral
396 | t.BigIntLiteral
397 | t.DecimalLiteral
398 | t.PrivateName,
399 value: t.Expression | t.PatternLike,
400 computed: boolean = false,
401 shorthand: boolean = false,
402 decorators: Array<t.Decorator> | null = null,
403 ): t.ObjectProperty {
404 return validateNode<t.ObjectProperty>({
405 type: "ObjectProperty",
406 key,
407 value,
408 computed,
409 shorthand,
410 decorators,
411 });
412 }
413 export function restElement(argument: t.LVal): t.RestElement {
414 return validateNode<t.RestElement>({
415 type: "RestElement",
416 argument,
417 });
418 }
419 export function returnStatement(
420 argument: t.Expression | null = null,
421 ): t.ReturnStatement {
422 return validateNode<t.ReturnStatement>({
423 type: "ReturnStatement",
424 argument,
425 });
426 }
427 export function sequenceExpression(
428 expressions: Array<t.Expression>,
429 ): t.SequenceExpression {
430 return validateNode<t.SequenceExpression>({
431 type: "SequenceExpression",
432 expressions,
433 });
434 }
435 export function parenthesizedExpression(
436 expression: t.Expression,
437 ): t.ParenthesizedExpression {
438 return validateNode<t.ParenthesizedExpression>({
439 type: "ParenthesizedExpression",
440 expression,
441 });
442 }
443 export function switchCase(
444 test: t.Expression | null | undefined = null,
445 consequent: Array<t.Statement>,
446 ): t.SwitchCase {
447 return validateNode<t.SwitchCase>({
448 type: "SwitchCase",
449 test,
450 consequent,
451 });
452 }
453 export function switchStatement(
454 discriminant: t.Expression,
455 cases: Array<t.SwitchCase>,
456 ): t.SwitchStatement {
457 return validateNode<t.SwitchStatement>({
458 type: "SwitchStatement",
459 discriminant,
460 cases,
461 });
462 }
463 export function thisExpression(): t.ThisExpression {
464 return {
465 type: "ThisExpression",
466 };
467 }
468 export function throwStatement(argument: t.Expression): t.ThrowStatement {
469 return validateNode<t.ThrowStatement>({
470 type: "ThrowStatement",
471 argument,
472 });
473 }
474 export function tryStatement(
475 block: t.BlockStatement,
476 handler: t.CatchClause | null = null,
477 finalizer: t.BlockStatement | null = null,
478 ): t.TryStatement {
479 return validateNode<t.TryStatement>({
480 type: "TryStatement",
481 block,
482 handler,
483 finalizer,
484 });
485 }
486 export function unaryExpression(
487 operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof",
488 argument: t.Expression,
489 prefix: boolean = true,
490 ): t.UnaryExpression {
491 return validateNode<t.UnaryExpression>({
492 type: "UnaryExpression",
493 operator,
494 argument,
495 prefix,
496 });
497 }
498 export function updateExpression(
499 operator: "++" | "--",
500 argument: t.Expression,
501 prefix: boolean = false,
502 ): t.UpdateExpression {
503 return validateNode<t.UpdateExpression>({
504 type: "UpdateExpression",
505 operator,
506 argument,
507 prefix,
508 });
509 }
510 export function variableDeclaration(
511 kind: "var" | "let" | "const" | "using",
512 declarations: Array<t.VariableDeclarator>,
513 ): t.VariableDeclaration {
514 return validateNode<t.VariableDeclaration>({
515 type: "VariableDeclaration",
516 kind,
517 declarations,
518 });
519 }
520 export function variableDeclarator(
521 id: t.LVal,
522 init: t.Expression | null = null,
523 ): t.VariableDeclarator {
524 return validateNode<t.VariableDeclarator>({
525 type: "VariableDeclarator",
526 id,
527 init,
528 });
529 }
530 export function whileStatement(
531 test: t.Expression,
532 body: t.Statement,
533 ): t.WhileStatement {
534 return validateNode<t.WhileStatement>({
535 type: "WhileStatement",
536 test,
537 body,
538 });
539 }
540 export function withStatement(
541 object: t.Expression,
542 body: t.Statement,
543 ): t.WithStatement {
544 return validateNode<t.WithStatement>({
545 type: "WithStatement",
546 object,
547 body,
548 });
549 }
550 export function assignmentPattern(
551 left:
552 | t.Identifier
553 | t.ObjectPattern
554 | t.ArrayPattern
555 | t.MemberExpression
556 | t.TSAsExpression
557 | t.TSSatisfiesExpression
558 | t.TSTypeAssertion
559 | t.TSNonNullExpression,
560 right: t.Expression,
561 ): t.AssignmentPattern {
562 return validateNode<t.AssignmentPattern>({
563 type: "AssignmentPattern",
564 left,
565 right,
566 });
567 }
568 export function arrayPattern(
569 elements: Array<null | t.PatternLike | t.LVal>,
570 ): t.ArrayPattern {
571 return validateNode<t.ArrayPattern>({
572 type: "ArrayPattern",
573 elements,
574 });
575 }
576 export function arrowFunctionExpression(
577 params: Array<t.Identifier | t.Pattern | t.RestElement>,
578 body: t.BlockStatement | t.Expression,
579 async: boolean = false,
580 ): t.ArrowFunctionExpression {
581 return validateNode<t.ArrowFunctionExpression>({
582 type: "ArrowFunctionExpression",
583 params,
584 body,
585 async,
586 expression: null,
587 });
588 }
589 export function classBody(
590 body: Array<
591 | t.ClassMethod
592 | t.ClassPrivateMethod
593 | t.ClassProperty
594 | t.ClassPrivateProperty
595 | t.ClassAccessorProperty
596 | t.TSDeclareMethod
597 | t.TSIndexSignature
598 | t.StaticBlock
599 >,
600 ): t.ClassBody {
601 return validateNode<t.ClassBody>({
602 type: "ClassBody",
603 body,
604 });
605 }
606 export function classExpression(
607 id: t.Identifier | null | undefined = null,
608 superClass: t.Expression | null | undefined = null,
609 body: t.ClassBody,
610 decorators: Array<t.Decorator> | null = null,
611 ): t.ClassExpression {
612 return validateNode<t.ClassExpression>({
613 type: "ClassExpression",
614 id,
615 superClass,
616 body,
617 decorators,
618 });
619 }
620 export function classDeclaration(
621 id: t.Identifier,
622 superClass: t.Expression | null | undefined = null,
623 body: t.ClassBody,
624 decorators: Array<t.Decorator> | null = null,
625 ): t.ClassDeclaration {
626 return validateNode<t.ClassDeclaration>({
627 type: "ClassDeclaration",
628 id,
629 superClass,
630 body,
631 decorators,
632 });
633 }
634 export function exportAllDeclaration(
635 source: t.StringLiteral,
636 ): t.ExportAllDeclaration {
637 return validateNode<t.ExportAllDeclaration>({
638 type: "ExportAllDeclaration",
639 source,
640 });
641 }
642 export function exportDefaultDeclaration(
643 declaration:
644 | t.TSDeclareFunction
645 | t.FunctionDeclaration
646 | t.ClassDeclaration
647 | t.Expression,
648 ): t.ExportDefaultDeclaration {
649 return validateNode<t.ExportDefaultDeclaration>({
650 type: "ExportDefaultDeclaration",
651 declaration,
652 });
653 }
654 export function exportNamedDeclaration(
655 declaration: t.Declaration | null = null,
656 specifiers: Array<
657 t.ExportSpecifier | t.ExportDefaultSpecifier | t.ExportNamespaceSpecifier
658 > = [],
659 source: t.StringLiteral | null = null,
660 ): t.ExportNamedDeclaration {
661 return validateNode<t.ExportNamedDeclaration>({
662 type: "ExportNamedDeclaration",
663 declaration,
664 specifiers,
665 source,
666 });
667 }
668 export function exportSpecifier(
669 local: t.Identifier,
670 exported: t.Identifier | t.StringLiteral,
671 ): t.ExportSpecifier {
672 return validateNode<t.ExportSpecifier>({
673 type: "ExportSpecifier",
674 local,
675 exported,
676 });
677 }
678 export function forOfStatement(
679 left: t.VariableDeclaration | t.LVal,
680 right: t.Expression,
681 body: t.Statement,
682 _await: boolean = false,
683 ): t.ForOfStatement {
684 return validateNode<t.ForOfStatement>({
685 type: "ForOfStatement",
686 left,
687 right,
688 body,
689 await: _await,
690 });
691 }
692 export function importDeclaration(
693 specifiers: Array<
694 t.ImportSpecifier | t.ImportDefaultSpecifier | t.ImportNamespaceSpecifier
695 >,
696 source: t.StringLiteral,
697 ): t.ImportDeclaration {
698 return validateNode<t.ImportDeclaration>({
699 type: "ImportDeclaration",
700 specifiers,
701 source,
702 });
703 }
704 export function importDefaultSpecifier(
705 local: t.Identifier,
706 ): t.ImportDefaultSpecifier {
707 return validateNode<t.ImportDefaultSpecifier>({
708 type: "ImportDefaultSpecifier",
709 local,
710 });
711 }
712 export function importNamespaceSpecifier(
713 local: t.Identifier,
714 ): t.ImportNamespaceSpecifier {
715 return validateNode<t.ImportNamespaceSpecifier>({
716 type: "ImportNamespaceSpecifier",
717 local,
718 });
719 }
720 export function importSpecifier(
721 local: t.Identifier,
722 imported: t.Identifier | t.StringLiteral,
723 ): t.ImportSpecifier {
724 return validateNode<t.ImportSpecifier>({
725 type: "ImportSpecifier",
726 local,
727 imported,
728 });
729 }
730 export function metaProperty(
731 meta: t.Identifier,
732 property: t.Identifier,
733 ): t.MetaProperty {
734 return validateNode<t.MetaProperty>({
735 type: "MetaProperty",
736 meta,
737 property,
738 });
739 }
740 export function classMethod(
741 kind: "get" | "set" | "method" | "constructor" | undefined = "method",
742 key:
743 | t.Identifier
744 | t.StringLiteral
745 | t.NumericLiteral
746 | t.BigIntLiteral
747 | t.Expression,
748 params: Array<
749 t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
750 >,
751 body: t.BlockStatement,
752 computed: boolean = false,
753 _static: boolean = false,
754 generator: boolean = false,
755 async: boolean = false,
756 ): t.ClassMethod {
757 return validateNode<t.ClassMethod>({
758 type: "ClassMethod",
759 kind,
760 key,
761 params,
762 body,
763 computed,
764 static: _static,
765 generator,
766 async,
767 });
768 }
769 export function objectPattern(
770 properties: Array<t.RestElement | t.ObjectProperty>,
771 ): t.ObjectPattern {
772 return validateNode<t.ObjectPattern>({
773 type: "ObjectPattern",
774 properties,
775 });
776 }
777 export function spreadElement(argument: t.Expression): t.SpreadElement {
778 return validateNode<t.SpreadElement>({
779 type: "SpreadElement",
780 argument,
781 });
782 }
783 function _super(): t.Super {
784 return {
785 type: "Super",
786 };
787 }
788 export { _super as super };
789 export function taggedTemplateExpression(
790 tag: t.Expression,
791 quasi: t.TemplateLiteral,
792 ): t.TaggedTemplateExpression {
793 return validateNode<t.TaggedTemplateExpression>({
794 type: "TaggedTemplateExpression",
795 tag,
796 quasi,
797 });
798 }
799 export function templateElement(
800 value: { raw: string; cooked?: string },
801 tail: boolean = false,
802 ): t.TemplateElement {
803 return validateNode<t.TemplateElement>({
804 type: "TemplateElement",
805 value,
806 tail,
807 });
808 }
809 export function templateLiteral(
810 quasis: Array<t.TemplateElement>,
811 expressions: Array<t.Expression | t.TSType>,
812 ): t.TemplateLiteral {
813 return validateNode<t.TemplateLiteral>({
814 type: "TemplateLiteral",
815 quasis,
816 expressions,
817 });
818 }
819 export function yieldExpression(
820 argument: t.Expression | null = null,
821 delegate: boolean = false,
822 ): t.YieldExpression {
823 return validateNode<t.YieldExpression>({
824 type: "YieldExpression",
825 argument,
826 delegate,
827 });
828 }
829 export function awaitExpression(argument: t.Expression): t.AwaitExpression {
830 return validateNode<t.AwaitExpression>({
831 type: "AwaitExpression",
832 argument,
833 });
834 }
835 function _import(): t.Import {
836 return {
837 type: "Import",
838 };
839 }
840 export { _import as import };
841 export function bigIntLiteral(value: string): t.BigIntLiteral {
842 return validateNode<t.BigIntLiteral>({
843 type: "BigIntLiteral",
844 value,
845 });
846 }
847 export function exportNamespaceSpecifier(
848 exported: t.Identifier,
849 ): t.ExportNamespaceSpecifier {
850 return validateNode<t.ExportNamespaceSpecifier>({
851 type: "ExportNamespaceSpecifier",
852 exported,
853 });
854 }
855 export function optionalMemberExpression(
856 object: t.Expression,
857 property: t.Expression | t.Identifier,
858 computed: boolean | undefined = false,
859 optional: boolean,
860 ): t.OptionalMemberExpression {
861 return validateNode<t.OptionalMemberExpression>({
862 type: "OptionalMemberExpression",
863 object,
864 property,
865 computed,
866 optional,
867 });
868 }
869 export function optionalCallExpression(
870 callee: t.Expression,
871 _arguments: Array<
872 t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder
873 >,
874 optional: boolean,
875 ): t.OptionalCallExpression {
876 return validateNode<t.OptionalCallExpression>({
877 type: "OptionalCallExpression",
878 callee,
879 arguments: _arguments,
880 optional,
881 });
882 }
883 export function classProperty(
884 key:
885 | t.Identifier
886 | t.StringLiteral
887 | t.NumericLiteral
888 | t.BigIntLiteral
889 | t.Expression,
890 value: t.Expression | null = null,
891 typeAnnotation: t.TypeAnnotation | t.TSTypeAnnotation | t.Noop | null = null,
892 decorators: Array<t.Decorator> | null = null,
893 computed: boolean = false,
894 _static: boolean = false,
895 ): t.ClassProperty {
896 return validateNode<t.ClassProperty>({
897 type: "ClassProperty",
898 key,
899 value,
900 typeAnnotation,
901 decorators,
902 computed,
903 static: _static,
904 });
905 }
906 export function classAccessorProperty(
907 key:
908 | t.Identifier
909 | t.StringLiteral
910 | t.NumericLiteral
911 | t.BigIntLiteral
912 | t.Expression
913 | t.PrivateName,
914 value: t.Expression | null = null,
915 typeAnnotation: t.TypeAnnotation | t.TSTypeAnnotation | t.Noop | null = null,
916 decorators: Array<t.Decorator> | null = null,
917 computed: boolean = false,
918 _static: boolean = false,
919 ): t.ClassAccessorProperty {
920 return validateNode<t.ClassAccessorProperty>({
921 type: "ClassAccessorProperty",
922 key,
923 value,
924 typeAnnotation,
925 decorators,
926 computed,
927 static: _static,
928 });
929 }
930 export function classPrivateProperty(
931 key: t.PrivateName,
932 value: t.Expression | null = null,
933 decorators: Array<t.Decorator> | null = null,
934 _static: boolean = false,
935 ): t.ClassPrivateProperty {
936 return validateNode<t.ClassPrivateProperty>({
937 type: "ClassPrivateProperty",
938 key,
939 value,
940 decorators,
941 static: _static,
942 });
943 }
944 export function classPrivateMethod(
945 kind: "get" | "set" | "method" | undefined = "method",
946 key: t.PrivateName,
947 params: Array<
948 t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
949 >,
950 body: t.BlockStatement,
951 _static: boolean = false,
952 ): t.ClassPrivateMethod {
953 return validateNode<t.ClassPrivateMethod>({
954 type: "ClassPrivateMethod",
955 kind,
956 key,
957 params,
958 body,
959 static: _static,
960 });
961 }
962 export function privateName(id: t.Identifier): t.PrivateName {
963 return validateNode<t.PrivateName>({
964 type: "PrivateName",
965 id,
966 });
967 }
968 export function staticBlock(body: Array<t.Statement>): t.StaticBlock {
969 return validateNode<t.StaticBlock>({
970 type: "StaticBlock",
971 body,
972 });
973 }
974 export function anyTypeAnnotation(): t.AnyTypeAnnotation {
975 return {
976 type: "AnyTypeAnnotation",
977 };
978 }
979 export function arrayTypeAnnotation(
980 elementType: t.FlowType,
981 ): t.ArrayTypeAnnotation {
982 return validateNode<t.ArrayTypeAnnotation>({
983 type: "ArrayTypeAnnotation",
984 elementType,
985 });
986 }
987 export function booleanTypeAnnotation(): t.BooleanTypeAnnotation {
988 return {
989 type: "BooleanTypeAnnotation",
990 };
991 }
992 export function booleanLiteralTypeAnnotation(
993 value: boolean,
994 ): t.BooleanLiteralTypeAnnotation {
995 return validateNode<t.BooleanLiteralTypeAnnotation>({
996 type: "BooleanLiteralTypeAnnotation",
997 value,
998 });
999 }
1000 export function nullLiteralTypeAnnotation(): t.NullLiteralTypeAnnotation {
1001 return {
1002 type: "NullLiteralTypeAnnotation",
1003 };
1004 }
1005 export function classImplements(
1006 id: t.Identifier,
1007 typeParameters: t.TypeParameterInstantiation | null = null,
1008 ): t.ClassImplements {
1009 return validateNode<t.ClassImplements>({
1010 type: "ClassImplements",
1011 id,
1012 typeParameters,
1013 });
1014 }
1015 export function declareClass(
1016 id: t.Identifier,
1017 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1018 _extends: Array<t.InterfaceExtends> | null | undefined = null,
1019 body: t.ObjectTypeAnnotation,
1020 ): t.DeclareClass {
1021 return validateNode<t.DeclareClass>({
1022 type: "DeclareClass",
1023 id,
1024 typeParameters,
1025 extends: _extends,
1026 body,
1027 });
1028 }
1029 export function declareFunction(id: t.Identifier): t.DeclareFunction {
1030 return validateNode<t.DeclareFunction>({
1031 type: "DeclareFunction",
1032 id,
1033 });
1034 }
1035 export function declareInterface(
1036 id: t.Identifier,
1037 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1038 _extends: Array<t.InterfaceExtends> | null | undefined = null,
1039 body: t.ObjectTypeAnnotation,
1040 ): t.DeclareInterface {
1041 return validateNode<t.DeclareInterface>({
1042 type: "DeclareInterface",
1043 id,
1044 typeParameters,
1045 extends: _extends,
1046 body,
1047 });
1048 }
1049 export function declareModule(
1050 id: t.Identifier | t.StringLiteral,
1051 body: t.BlockStatement,
1052 kind: "CommonJS" | "ES" | null = null,
1053 ): t.DeclareModule {
1054 return validateNode<t.DeclareModule>({
1055 type: "DeclareModule",
1056 id,
1057 body,
1058 kind,
1059 });
1060 }
1061 export function declareModuleExports(
1062 typeAnnotation: t.TypeAnnotation,
1063 ): t.DeclareModuleExports {
1064 return validateNode<t.DeclareModuleExports>({
1065 type: "DeclareModuleExports",
1066 typeAnnotation,
1067 });
1068 }
1069 export function declareTypeAlias(
1070 id: t.Identifier,
1071 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1072 right: t.FlowType,
1073 ): t.DeclareTypeAlias {
1074 return validateNode<t.DeclareTypeAlias>({
1075 type: "DeclareTypeAlias",
1076 id,
1077 typeParameters,
1078 right,
1079 });
1080 }
1081 export function declareOpaqueType(
1082 id: t.Identifier,
1083 typeParameters: t.TypeParameterDeclaration | null = null,
1084 supertype: t.FlowType | null = null,
1085 ): t.DeclareOpaqueType {
1086 return validateNode<t.DeclareOpaqueType>({
1087 type: "DeclareOpaqueType",
1088 id,
1089 typeParameters,
1090 supertype,
1091 });
1092 }
1093 export function declareVariable(id: t.Identifier): t.DeclareVariable {
1094 return validateNode<t.DeclareVariable>({
1095 type: "DeclareVariable",
1096 id,
1097 });
1098 }
1099 export function declareExportDeclaration(
1100 declaration: t.Flow | null = null,
1101 specifiers: Array<
1102 t.ExportSpecifier | t.ExportNamespaceSpecifier
1103 > | null = null,
1104 source: t.StringLiteral | null = null,
1105 ): t.DeclareExportDeclaration {
1106 return validateNode<t.DeclareExportDeclaration>({
1107 type: "DeclareExportDeclaration",
1108 declaration,
1109 specifiers,
1110 source,
1111 });
1112 }
1113 export function declareExportAllDeclaration(
1114 source: t.StringLiteral,
1115 ): t.DeclareExportAllDeclaration {
1116 return validateNode<t.DeclareExportAllDeclaration>({
1117 type: "DeclareExportAllDeclaration",
1118 source,
1119 });
1120 }
1121 export function declaredPredicate(value: t.Flow): t.DeclaredPredicate {
1122 return validateNode<t.DeclaredPredicate>({
1123 type: "DeclaredPredicate",
1124 value,
1125 });
1126 }
1127 export function existsTypeAnnotation(): t.ExistsTypeAnnotation {
1128 return {
1129 type: "ExistsTypeAnnotation",
1130 };
1131 }
1132 export function functionTypeAnnotation(
1133 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1134 params: Array<t.FunctionTypeParam>,
1135 rest: t.FunctionTypeParam | null | undefined = null,
1136 returnType: t.FlowType,
1137 ): t.FunctionTypeAnnotation {
1138 return validateNode<t.FunctionTypeAnnotation>({
1139 type: "FunctionTypeAnnotation",
1140 typeParameters,
1141 params,
1142 rest,
1143 returnType,
1144 });
1145 }
1146 export function functionTypeParam(
1147 name: t.Identifier | null | undefined = null,
1148 typeAnnotation: t.FlowType,
1149 ): t.FunctionTypeParam {
1150 return validateNode<t.FunctionTypeParam>({
1151 type: "FunctionTypeParam",
1152 name,
1153 typeAnnotation,
1154 });
1155 }
1156 export function genericTypeAnnotation(
1157 id: t.Identifier | t.QualifiedTypeIdentifier,
1158 typeParameters: t.TypeParameterInstantiation | null = null,
1159 ): t.GenericTypeAnnotation {
1160 return validateNode<t.GenericTypeAnnotation>({
1161 type: "GenericTypeAnnotation",
1162 id,
1163 typeParameters,
1164 });
1165 }
1166 export function inferredPredicate(): t.InferredPredicate {
1167 return {
1168 type: "InferredPredicate",
1169 };
1170 }
1171 export function interfaceExtends(
1172 id: t.Identifier | t.QualifiedTypeIdentifier,
1173 typeParameters: t.TypeParameterInstantiation | null = null,
1174 ): t.InterfaceExtends {
1175 return validateNode<t.InterfaceExtends>({
1176 type: "InterfaceExtends",
1177 id,
1178 typeParameters,
1179 });
1180 }
1181 export function interfaceDeclaration(
1182 id: t.Identifier,
1183 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1184 _extends: Array<t.InterfaceExtends> | null | undefined = null,
1185 body: t.ObjectTypeAnnotation,
1186 ): t.InterfaceDeclaration {
1187 return validateNode<t.InterfaceDeclaration>({
1188 type: "InterfaceDeclaration",
1189 id,
1190 typeParameters,
1191 extends: _extends,
1192 body,
1193 });
1194 }
1195 export function interfaceTypeAnnotation(
1196 _extends: Array<t.InterfaceExtends> | null | undefined = null,
1197 body: t.ObjectTypeAnnotation,
1198 ): t.InterfaceTypeAnnotation {
1199 return validateNode<t.InterfaceTypeAnnotation>({
1200 type: "InterfaceTypeAnnotation",
1201 extends: _extends,
1202 body,
1203 });
1204 }
1205 export function intersectionTypeAnnotation(
1206 types: Array<t.FlowType>,
1207 ): t.IntersectionTypeAnnotation {
1208 return validateNode<t.IntersectionTypeAnnotation>({
1209 type: "IntersectionTypeAnnotation",
1210 types,
1211 });
1212 }
1213 export function mixedTypeAnnotation(): t.MixedTypeAnnotation {
1214 return {
1215 type: "MixedTypeAnnotation",
1216 };
1217 }
1218 export function emptyTypeAnnotation(): t.EmptyTypeAnnotation {
1219 return {
1220 type: "EmptyTypeAnnotation",
1221 };
1222 }
1223 export function nullableTypeAnnotation(
1224 typeAnnotation: t.FlowType,
1225 ): t.NullableTypeAnnotation {
1226 return validateNode<t.NullableTypeAnnotation>({
1227 type: "NullableTypeAnnotation",
1228 typeAnnotation,
1229 });
1230 }
1231 export function numberLiteralTypeAnnotation(
1232 value: number,
1233 ): t.NumberLiteralTypeAnnotation {
1234 return validateNode<t.NumberLiteralTypeAnnotation>({
1235 type: "NumberLiteralTypeAnnotation",
1236 value,
1237 });
1238 }
1239 export function numberTypeAnnotation(): t.NumberTypeAnnotation {
1240 return {
1241 type: "NumberTypeAnnotation",
1242 };
1243 }
1244 export function objectTypeAnnotation(
1245 properties: Array<t.ObjectTypeProperty | t.ObjectTypeSpreadProperty>,
1246 indexers: Array<t.ObjectTypeIndexer> = [],
1247 callProperties: Array<t.ObjectTypeCallProperty> = [],
1248 internalSlots: Array<t.ObjectTypeInternalSlot> = [],
1249 exact: boolean = false,
1250 ): t.ObjectTypeAnnotation {
1251 return validateNode<t.ObjectTypeAnnotation>({
1252 type: "ObjectTypeAnnotation",
1253 properties,
1254 indexers,
1255 callProperties,
1256 internalSlots,
1257 exact,
1258 });
1259 }
1260 export function objectTypeInternalSlot(
1261 id: t.Identifier,
1262 value: t.FlowType,
1263 optional: boolean,
1264 _static: boolean,
1265 method: boolean,
1266 ): t.ObjectTypeInternalSlot {
1267 return validateNode<t.ObjectTypeInternalSlot>({
1268 type: "ObjectTypeInternalSlot",
1269 id,
1270 value,
1271 optional,
1272 static: _static,
1273 method,
1274 });
1275 }
1276 export function objectTypeCallProperty(
1277 value: t.FlowType,
1278 ): t.ObjectTypeCallProperty {
1279 return validateNode<t.ObjectTypeCallProperty>({
1280 type: "ObjectTypeCallProperty",
1281 value,
1282 static: null,
1283 });
1284 }
1285 export function objectTypeIndexer(
1286 id: t.Identifier | null | undefined = null,
1287 key: t.FlowType,
1288 value: t.FlowType,
1289 variance: t.Variance | null = null,
1290 ): t.ObjectTypeIndexer {
1291 return validateNode<t.ObjectTypeIndexer>({
1292 type: "ObjectTypeIndexer",
1293 id,
1294 key,
1295 value,
1296 variance,
1297 static: null,
1298 });
1299 }
1300 export function objectTypeProperty(
1301 key: t.Identifier | t.StringLiteral,
1302 value: t.FlowType,
1303 variance: t.Variance | null = null,
1304 ): t.ObjectTypeProperty {
1305 return validateNode<t.ObjectTypeProperty>({
1306 type: "ObjectTypeProperty",
1307 key,
1308 value,
1309 variance,
1310 kind: null,
1311 method: null,
1312 optional: null,
1313 proto: null,
1314 static: null,
1315 });
1316 }
1317 export function objectTypeSpreadProperty(
1318 argument: t.FlowType,
1319 ): t.ObjectTypeSpreadProperty {
1320 return validateNode<t.ObjectTypeSpreadProperty>({
1321 type: "ObjectTypeSpreadProperty",
1322 argument,
1323 });
1324 }
1325 export function opaqueType(
1326 id: t.Identifier,
1327 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1328 supertype: t.FlowType | null | undefined = null,
1329 impltype: t.FlowType,
1330 ): t.OpaqueType {
1331 return validateNode<t.OpaqueType>({
1332 type: "OpaqueType",
1333 id,
1334 typeParameters,
1335 supertype,
1336 impltype,
1337 });
1338 }
1339 export function qualifiedTypeIdentifier(
1340 id: t.Identifier,
1341 qualification: t.Identifier | t.QualifiedTypeIdentifier,
1342 ): t.QualifiedTypeIdentifier {
1343 return validateNode<t.QualifiedTypeIdentifier>({
1344 type: "QualifiedTypeIdentifier",
1345 id,
1346 qualification,
1347 });
1348 }
1349 export function stringLiteralTypeAnnotation(
1350 value: string,
1351 ): t.StringLiteralTypeAnnotation {
1352 return validateNode<t.StringLiteralTypeAnnotation>({
1353 type: "StringLiteralTypeAnnotation",
1354 value,
1355 });
1356 }
1357 export function stringTypeAnnotation(): t.StringTypeAnnotation {
1358 return {
1359 type: "StringTypeAnnotation",
1360 };
1361 }
1362 export function symbolTypeAnnotation(): t.SymbolTypeAnnotation {
1363 return {
1364 type: "SymbolTypeAnnotation",
1365 };
1366 }
1367 export function thisTypeAnnotation(): t.ThisTypeAnnotation {
1368 return {
1369 type: "ThisTypeAnnotation",
1370 };
1371 }
1372 export function tupleTypeAnnotation(
1373 types: Array<t.FlowType>,
1374 ): t.TupleTypeAnnotation {
1375 return validateNode<t.TupleTypeAnnotation>({
1376 type: "TupleTypeAnnotation",
1377 types,
1378 });
1379 }
1380 export function typeofTypeAnnotation(
1381 argument: t.FlowType,
1382 ): t.TypeofTypeAnnotation {
1383 return validateNode<t.TypeofTypeAnnotation>({
1384 type: "TypeofTypeAnnotation",
1385 argument,
1386 });
1387 }
1388 export function typeAlias(
1389 id: t.Identifier,
1390 typeParameters: t.TypeParameterDeclaration | null | undefined = null,
1391 right: t.FlowType,
1392 ): t.TypeAlias {
1393 return validateNode<t.TypeAlias>({
1394 type: "TypeAlias",
1395 id,
1396 typeParameters,
1397 right,
1398 });
1399 }
1400 export function typeAnnotation(typeAnnotation: t.FlowType): t.TypeAnnotation {
1401 return validateNode<t.TypeAnnotation>({
1402 type: "TypeAnnotation",
1403 typeAnnotation,
1404 });
1405 }
1406 export function typeCastExpression(
1407 expression: t.Expression,
1408 typeAnnotation: t.TypeAnnotation,
1409 ): t.TypeCastExpression {
1410 return validateNode<t.TypeCastExpression>({
1411 type: "TypeCastExpression",
1412 expression,
1413 typeAnnotation,
1414 });
1415 }
1416 export function typeParameter(
1417 bound: t.TypeAnnotation | null = null,
1418 _default: t.FlowType | null = null,
1419 variance: t.Variance | null = null,
1420 ): t.TypeParameter {
1421 return validateNode<t.TypeParameter>({
1422 type: "TypeParameter",
1423 bound,
1424 default: _default,
1425 variance,
1426 name: null,
1427 });
1428 }
1429 export function typeParameterDeclaration(
1430 params: Array<t.TypeParameter>,
1431 ): t.TypeParameterDeclaration {
1432 return validateNode<t.TypeParameterDeclaration>({
1433 type: "TypeParameterDeclaration",
1434 params,
1435 });
1436 }
1437 export function typeParameterInstantiation(
1438 params: Array<t.FlowType>,
1439 ): t.TypeParameterInstantiation {
1440 return validateNode<t.TypeParameterInstantiation>({
1441 type: "TypeParameterInstantiation",
1442 params,
1443 });
1444 }
1445 export function unionTypeAnnotation(
1446 types: Array<t.FlowType>,
1447 ): t.UnionTypeAnnotation {
1448 return validateNode<t.UnionTypeAnnotation>({
1449 type: "UnionTypeAnnotation",
1450 types,
1451 });
1452 }
1453 export function variance(kind: "minus" | "plus"): t.Variance {
1454 return validateNode<t.Variance>({
1455 type: "Variance",
1456 kind,
1457 });
1458 }
1459 export function voidTypeAnnotation(): t.VoidTypeAnnotation {
1460 return {
1461 type: "VoidTypeAnnotation",
1462 };
1463 }
1464 export function enumDeclaration(
1465 id: t.Identifier,
1466 body:
1467 | t.EnumBooleanBody
1468 | t.EnumNumberBody
1469 | t.EnumStringBody
1470 | t.EnumSymbolBody,
1471 ): t.EnumDeclaration {
1472 return validateNode<t.EnumDeclaration>({
1473 type: "EnumDeclaration",
1474 id,
1475 body,
1476 });
1477 }
1478 export function enumBooleanBody(
1479 members: Array<t.EnumBooleanMember>,
1480 ): t.EnumBooleanBody {
1481 return validateNode<t.EnumBooleanBody>({
1482 type: "EnumBooleanBody",
1483 members,
1484 explicitType: null,
1485 hasUnknownMembers: null,
1486 });
1487 }
1488 export function enumNumberBody(
1489 members: Array<t.EnumNumberMember>,
1490 ): t.EnumNumberBody {
1491 return validateNode<t.EnumNumberBody>({
1492 type: "EnumNumberBody",
1493 members,
1494 explicitType: null,
1495 hasUnknownMembers: null,
1496 });
1497 }
1498 export function enumStringBody(
1499 members: Array<t.EnumStringMember | t.EnumDefaultedMember>,
1500 ): t.EnumStringBody {
1501 return validateNode<t.EnumStringBody>({
1502 type: "EnumStringBody",
1503 members,
1504 explicitType: null,
1505 hasUnknownMembers: null,
1506 });
1507 }
1508 export function enumSymbolBody(
1509 members: Array<t.EnumDefaultedMember>,
1510 ): t.EnumSymbolBody {
1511 return validateNode<t.EnumSymbolBody>({
1512 type: "EnumSymbolBody",
1513 members,
1514 hasUnknownMembers: null,
1515 });
1516 }
1517 export function enumBooleanMember(id: t.Identifier): t.EnumBooleanMember {
1518 return validateNode<t.EnumBooleanMember>({
1519 type: "EnumBooleanMember",
1520 id,
1521 init: null,
1522 });
1523 }
1524 export function enumNumberMember(
1525 id: t.Identifier,
1526 init: t.NumericLiteral,
1527 ): t.EnumNumberMember {
1528 return validateNode<t.EnumNumberMember>({
1529 type: "EnumNumberMember",
1530 id,
1531 init,
1532 });
1533 }
1534 export function enumStringMember(
1535 id: t.Identifier,
1536 init: t.StringLiteral,
1537 ): t.EnumStringMember {
1538 return validateNode<t.EnumStringMember>({
1539 type: "EnumStringMember",
1540 id,
1541 init,
1542 });
1543 }
1544 export function enumDefaultedMember(id: t.Identifier): t.EnumDefaultedMember {
1545 return validateNode<t.EnumDefaultedMember>({
1546 type: "EnumDefaultedMember",
1547 id,
1548 });
1549 }
1550 export function indexedAccessType(
1551 objectType: t.FlowType,
1552 indexType: t.FlowType,
1553 ): t.IndexedAccessType {
1554 return validateNode<t.IndexedAccessType>({
1555 type: "IndexedAccessType",
1556 objectType,
1557 indexType,
1558 });
1559 }
1560 export function optionalIndexedAccessType(
1561 objectType: t.FlowType,
1562 indexType: t.FlowType,
1563 ): t.OptionalIndexedAccessType {
1564 return validateNode<t.OptionalIndexedAccessType>({
1565 type: "OptionalIndexedAccessType",
1566 objectType,
1567 indexType,
1568 optional: null,
1569 });
1570 }
1571 export function jsxAttribute(
1572 name: t.JSXIdentifier | t.JSXNamespacedName,
1573 value:
1574 | t.JSXElement
1575 | t.JSXFragment
1576 | t.StringLiteral
1577 | t.JSXExpressionContainer
1578 | null = null,
1579 ): t.JSXAttribute {
1580 return validateNode<t.JSXAttribute>({
1581 type: "JSXAttribute",
1582 name,
1583 value,
1584 });
1585 }
1586 export { jsxAttribute as jSXAttribute };
1587 export function jsxClosingElement(
1588 name: t.JSXIdentifier | t.JSXMemberExpression | t.JSXNamespacedName,
1589 ): t.JSXClosingElement {
1590 return validateNode<t.JSXClosingElement>({
1591 type: "JSXClosingElement",
1592 name,
1593 });
1594 }
1595 export { jsxClosingElement as jSXClosingElement };
1596 export function jsxElement(
1597 openingElement: t.JSXOpeningElement,
1598 closingElement: t.JSXClosingElement | null | undefined = null,
1599 children: Array<
1600 | t.JSXText
1601 | t.JSXExpressionContainer
1602 | t.JSXSpreadChild
1603 | t.JSXElement
1604 | t.JSXFragment
1605 >,
1606 selfClosing: boolean | null = null,
1607 ): t.JSXElement {
1608 return validateNode<t.JSXElement>({
1609 type: "JSXElement",
1610 openingElement,
1611 closingElement,
1612 children,
1613 selfClosing,
1614 });
1615 }
1616 export { jsxElement as jSXElement };
1617 export function jsxEmptyExpression(): t.JSXEmptyExpression {
1618 return {
1619 type: "JSXEmptyExpression",
1620 };
1621 }
1622 export { jsxEmptyExpression as jSXEmptyExpression };
1623 export function jsxExpressionContainer(
1624 expression: t.Expression | t.JSXEmptyExpression,
1625 ): t.JSXExpressionContainer {
1626 return validateNode<t.JSXExpressionContainer>({
1627 type: "JSXExpressionContainer",
1628 expression,
1629 });
1630 }
1631 export { jsxExpressionContainer as jSXExpressionContainer };
1632 export function jsxSpreadChild(expression: t.Expression): t.JSXSpreadChild {
1633 return validateNode<t.JSXSpreadChild>({
1634 type: "JSXSpreadChild",
1635 expression,
1636 });
1637 }
1638 export { jsxSpreadChild as jSXSpreadChild };
1639 export function jsxIdentifier(name: string): t.JSXIdentifier {
1640 return validateNode<t.JSXIdentifier>({
1641 type: "JSXIdentifier",
1642 name,
1643 });
1644 }
1645 export { jsxIdentifier as jSXIdentifier };
1646 export function jsxMemberExpression(
1647 object: t.JSXMemberExpression | t.JSXIdentifier,
1648 property: t.JSXIdentifier,
1649 ): t.JSXMemberExpression {
1650 return validateNode<t.JSXMemberExpression>({
1651 type: "JSXMemberExpression",
1652 object,
1653 property,
1654 });
1655 }
1656 export { jsxMemberExpression as jSXMemberExpression };
1657 export function jsxNamespacedName(
1658 namespace: t.JSXIdentifier,
1659 name: t.JSXIdentifier,
1660 ): t.JSXNamespacedName {
1661 return validateNode<t.JSXNamespacedName>({
1662 type: "JSXNamespacedName",
1663 namespace,
1664 name,
1665 });
1666 }
1667 export { jsxNamespacedName as jSXNamespacedName };
1668 export function jsxOpeningElement(
1669 name: t.JSXIdentifier | t.JSXMemberExpression | t.JSXNamespacedName,
1670 attributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>,
1671 selfClosing: boolean = false,
1672 ): t.JSXOpeningElement {
1673 return validateNode<t.JSXOpeningElement>({
1674 type: "JSXOpeningElement",
1675 name,
1676 attributes,
1677 selfClosing,
1678 });
1679 }
1680 export { jsxOpeningElement as jSXOpeningElement };
1681 export function jsxSpreadAttribute(
1682 argument: t.Expression,
1683 ): t.JSXSpreadAttribute {
1684 return validateNode<t.JSXSpreadAttribute>({
1685 type: "JSXSpreadAttribute",
1686 argument,
1687 });
1688 }
1689 export { jsxSpreadAttribute as jSXSpreadAttribute };
1690 export function jsxText(value: string): t.JSXText {
1691 return validateNode<t.JSXText>({
1692 type: "JSXText",
1693 value,
1694 });
1695 }
1696 export { jsxText as jSXText };
1697 export function jsxFragment(
1698 openingFragment: t.JSXOpeningFragment,
1699 closingFragment: t.JSXClosingFragment,
1700 children: Array<
1701 | t.JSXText
1702 | t.JSXExpressionContainer
1703 | t.JSXSpreadChild
1704 | t.JSXElement
1705 | t.JSXFragment
1706 >,
1707 ): t.JSXFragment {
1708 return validateNode<t.JSXFragment>({
1709 type: "JSXFragment",
1710 openingFragment,
1711 closingFragment,
1712 children,
1713 });
1714 }
1715 export { jsxFragment as jSXFragment };
1716 export function jsxOpeningFragment(): t.JSXOpeningFragment {
1717 return {
1718 type: "JSXOpeningFragment",
1719 };
1720 }
1721 export { jsxOpeningFragment as jSXOpeningFragment };
1722 export function jsxClosingFragment(): t.JSXClosingFragment {
1723 return {
1724 type: "JSXClosingFragment",
1725 };
1726 }
1727 export { jsxClosingFragment as jSXClosingFragment };
1728 export function noop(): t.Noop {
1729 return {
1730 type: "Noop",
1731 };
1732 }
1733 export function placeholder(
1734 expectedNode:
1735 | "Identifier"
1736 | "StringLiteral"
1737 | "Expression"
1738 | "Statement"
1739 | "Declaration"
1740 | "BlockStatement"
1741 | "ClassBody"
1742 | "Pattern",
1743 name: t.Identifier,
1744 ): t.Placeholder {
1745 return validateNode<t.Placeholder>({
1746 type: "Placeholder",
1747 expectedNode,
1748 name,
1749 });
1750 }
1751 export function v8IntrinsicIdentifier(name: string): t.V8IntrinsicIdentifier {
1752 return validateNode<t.V8IntrinsicIdentifier>({
1753 type: "V8IntrinsicIdentifier",
1754 name,
1755 });
1756 }
1757 export function argumentPlaceholder(): t.ArgumentPlaceholder {
1758 return {
1759 type: "ArgumentPlaceholder",
1760 };
1761 }
1762 export function bindExpression(
1763 object: t.Expression,
1764 callee: t.Expression,
1765 ): t.BindExpression {
1766 return validateNode<t.BindExpression>({
1767 type: "BindExpression",
1768 object,
1769 callee,
1770 });
1771 }
1772 export function importAttribute(
1773 key: t.Identifier | t.StringLiteral,
1774 value: t.StringLiteral,
1775 ): t.ImportAttribute {
1776 return validateNode<t.ImportAttribute>({
1777 type: "ImportAttribute",
1778 key,
1779 value,
1780 });
1781 }
1782 export function decorator(expression: t.Expression): t.Decorator {
1783 return validateNode<t.Decorator>({
1784 type: "Decorator",
1785 expression,
1786 });
1787 }
1788 export function doExpression(
1789 body: t.BlockStatement,
1790 async: boolean = false,
1791 ): t.DoExpression {
1792 return validateNode<t.DoExpression>({
1793 type: "DoExpression",
1794 body,
1795 async,
1796 });
1797 }
1798 export function exportDefaultSpecifier(
1799 exported: t.Identifier,
1800 ): t.ExportDefaultSpecifier {
1801 return validateNode<t.ExportDefaultSpecifier>({
1802 type: "ExportDefaultSpecifier",
1803 exported,
1804 });
1805 }
1806 export function recordExpression(
1807 properties: Array<t.ObjectProperty | t.SpreadElement>,
1808 ): t.RecordExpression {
1809 return validateNode<t.RecordExpression>({
1810 type: "RecordExpression",
1811 properties,
1812 });
1813 }
1814 export function tupleExpression(
1815 elements: Array<t.Expression | t.SpreadElement> = [],
1816 ): t.TupleExpression {
1817 return validateNode<t.TupleExpression>({
1818 type: "TupleExpression",
1819 elements,
1820 });
1821 }
1822 export function decimalLiteral(value: string): t.DecimalLiteral {
1823 return validateNode<t.DecimalLiteral>({
1824 type: "DecimalLiteral",
1825 value,
1826 });
1827 }
1828 export function moduleExpression(body: t.Program): t.ModuleExpression {
1829 return validateNode<t.ModuleExpression>({
1830 type: "ModuleExpression",
1831 body,
1832 });
1833 }
1834 export function topicReference(): t.TopicReference {
1835 return {
1836 type: "TopicReference",
1837 };
1838 }
1839 export function pipelineTopicExpression(
1840 expression: t.Expression,
1841 ): t.PipelineTopicExpression {
1842 return validateNode<t.PipelineTopicExpression>({
1843 type: "PipelineTopicExpression",
1844 expression,
1845 });
1846 }
1847 export function pipelineBareFunction(
1848 callee: t.Expression,
1849 ): t.PipelineBareFunction {
1850 return validateNode<t.PipelineBareFunction>({
1851 type: "PipelineBareFunction",
1852 callee,
1853 });
1854 }
1855 export function pipelinePrimaryTopicReference(): t.PipelinePrimaryTopicReference {
1856 return {
1857 type: "PipelinePrimaryTopicReference",
1858 };
1859 }
1860 export function tsParameterProperty(
1861 parameter: t.Identifier | t.AssignmentPattern,
1862 ): t.TSParameterProperty {
1863 return validateNode<t.TSParameterProperty>({
1864 type: "TSParameterProperty",
1865 parameter,
1866 });
1867 }
1868 export { tsParameterProperty as tSParameterProperty };
1869 export function tsDeclareFunction(
1870 id: t.Identifier | null | undefined = null,
1871 typeParameters:
1872 | t.TSTypeParameterDeclaration
1873 | t.Noop
1874 | null
1875 | undefined = null,
1876 params: Array<t.Identifier | t.Pattern | t.RestElement>,
1877 returnType: t.TSTypeAnnotation | t.Noop | null = null,
1878 ): t.TSDeclareFunction {
1879 return validateNode<t.TSDeclareFunction>({
1880 type: "TSDeclareFunction",
1881 id,
1882 typeParameters,
1883 params,
1884 returnType,
1885 });
1886 }
1887 export { tsDeclareFunction as tSDeclareFunction };
1888 export function tsDeclareMethod(
1889 decorators: Array<t.Decorator> | null | undefined = null,
1890 key:
1891 | t.Identifier
1892 | t.StringLiteral
1893 | t.NumericLiteral
1894 | t.BigIntLiteral
1895 | t.Expression,
1896 typeParameters:
1897 | t.TSTypeParameterDeclaration
1898 | t.Noop
1899 | null
1900 | undefined = null,
1901 params: Array<
1902 t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
1903 >,
1904 returnType: t.TSTypeAnnotation | t.Noop | null = null,
1905 ): t.TSDeclareMethod {
1906 return validateNode<t.TSDeclareMethod>({
1907 type: "TSDeclareMethod",
1908 decorators,
1909 key,
1910 typeParameters,
1911 params,
1912 returnType,
1913 });
1914 }
1915 export { tsDeclareMethod as tSDeclareMethod };
1916 export function tsQualifiedName(
1917 left: t.TSEntityName,
1918 right: t.Identifier,
1919 ): t.TSQualifiedName {
1920 return validateNode<t.TSQualifiedName>({
1921 type: "TSQualifiedName",
1922 left,
1923 right,
1924 });
1925 }
1926 export { tsQualifiedName as tSQualifiedName };
1927 export function tsCallSignatureDeclaration(
1928 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
1929 parameters: Array<t.Identifier | t.RestElement>,
1930 typeAnnotation: t.TSTypeAnnotation | null = null,
1931 ): t.TSCallSignatureDeclaration {
1932 return validateNode<t.TSCallSignatureDeclaration>({
1933 type: "TSCallSignatureDeclaration",
1934 typeParameters,
1935 parameters,
1936 typeAnnotation,
1937 });
1938 }
1939 export { tsCallSignatureDeclaration as tSCallSignatureDeclaration };
1940 export function tsConstructSignatureDeclaration(
1941 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
1942 parameters: Array<t.Identifier | t.RestElement>,
1943 typeAnnotation: t.TSTypeAnnotation | null = null,
1944 ): t.TSConstructSignatureDeclaration {
1945 return validateNode<t.TSConstructSignatureDeclaration>({
1946 type: "TSConstructSignatureDeclaration",
1947 typeParameters,
1948 parameters,
1949 typeAnnotation,
1950 });
1951 }
1952 export { tsConstructSignatureDeclaration as tSConstructSignatureDeclaration };
1953 export function tsPropertySignature(
1954 key: t.Expression,
1955 typeAnnotation: t.TSTypeAnnotation | null = null,
1956 initializer: t.Expression | null = null,
1957 ): t.TSPropertySignature {
1958 return validateNode<t.TSPropertySignature>({
1959 type: "TSPropertySignature",
1960 key,
1961 typeAnnotation,
1962 initializer,
1963 kind: null,
1964 });
1965 }
1966 export { tsPropertySignature as tSPropertySignature };
1967 export function tsMethodSignature(
1968 key: t.Expression,
1969 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
1970 parameters: Array<t.Identifier | t.RestElement>,
1971 typeAnnotation: t.TSTypeAnnotation | null = null,
1972 ): t.TSMethodSignature {
1973 return validateNode<t.TSMethodSignature>({
1974 type: "TSMethodSignature",
1975 key,
1976 typeParameters,
1977 parameters,
1978 typeAnnotation,
1979 kind: null,
1980 });
1981 }
1982 export { tsMethodSignature as tSMethodSignature };
1983 export function tsIndexSignature(
1984 parameters: Array<t.Identifier>,
1985 typeAnnotation: t.TSTypeAnnotation | null = null,
1986 ): t.TSIndexSignature {
1987 return validateNode<t.TSIndexSignature>({
1988 type: "TSIndexSignature",
1989 parameters,
1990 typeAnnotation,
1991 });
1992 }
1993 export { tsIndexSignature as tSIndexSignature };
1994 export function tsAnyKeyword(): t.TSAnyKeyword {
1995 return {
1996 type: "TSAnyKeyword",
1997 };
1998 }
1999 export { tsAnyKeyword as tSAnyKeyword };
2000 export function tsBooleanKeyword(): t.TSBooleanKeyword {
2001 return {
2002 type: "TSBooleanKeyword",
2003 };
2004 }
2005 export { tsBooleanKeyword as tSBooleanKeyword };
2006 export function tsBigIntKeyword(): t.TSBigIntKeyword {
2007 return {
2008 type: "TSBigIntKeyword",
2009 };
2010 }
2011 export { tsBigIntKeyword as tSBigIntKeyword };
2012 export function tsIntrinsicKeyword(): t.TSIntrinsicKeyword {
2013 return {
2014 type: "TSIntrinsicKeyword",
2015 };
2016 }
2017 export { tsIntrinsicKeyword as tSIntrinsicKeyword };
2018 export function tsNeverKeyword(): t.TSNeverKeyword {
2019 return {
2020 type: "TSNeverKeyword",
2021 };
2022 }
2023 export { tsNeverKeyword as tSNeverKeyword };
2024 export function tsNullKeyword(): t.TSNullKeyword {
2025 return {
2026 type: "TSNullKeyword",
2027 };
2028 }
2029 export { tsNullKeyword as tSNullKeyword };
2030 export function tsNumberKeyword(): t.TSNumberKeyword {
2031 return {
2032 type: "TSNumberKeyword",
2033 };
2034 }
2035 export { tsNumberKeyword as tSNumberKeyword };
2036 export function tsObjectKeyword(): t.TSObjectKeyword {
2037 return {
2038 type: "TSObjectKeyword",
2039 };
2040 }
2041 export { tsObjectKeyword as tSObjectKeyword };
2042 export function tsStringKeyword(): t.TSStringKeyword {
2043 return {
2044 type: "TSStringKeyword",
2045 };
2046 }
2047 export { tsStringKeyword as tSStringKeyword };
2048 export function tsSymbolKeyword(): t.TSSymbolKeyword {
2049 return {
2050 type: "TSSymbolKeyword",
2051 };
2052 }
2053 export { tsSymbolKeyword as tSSymbolKeyword };
2054 export function tsUndefinedKeyword(): t.TSUndefinedKeyword {
2055 return {
2056 type: "TSUndefinedKeyword",
2057 };
2058 }
2059 export { tsUndefinedKeyword as tSUndefinedKeyword };
2060 export function tsUnknownKeyword(): t.TSUnknownKeyword {
2061 return {
2062 type: "TSUnknownKeyword",
2063 };
2064 }
2065 export { tsUnknownKeyword as tSUnknownKeyword };
2066 export function tsVoidKeyword(): t.TSVoidKeyword {
2067 return {
2068 type: "TSVoidKeyword",
2069 };
2070 }
2071 export { tsVoidKeyword as tSVoidKeyword };
2072 export function tsThisType(): t.TSThisType {
2073 return {
2074 type: "TSThisType",
2075 };
2076 }
2077 export { tsThisType as tSThisType };
2078 export function tsFunctionType(
2079 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
2080 parameters: Array<t.Identifier | t.RestElement>,
2081 typeAnnotation: t.TSTypeAnnotation | null = null,
2082 ): t.TSFunctionType {
2083 return validateNode<t.TSFunctionType>({
2084 type: "TSFunctionType",
2085 typeParameters,
2086 parameters,
2087 typeAnnotation,
2088 });
2089 }
2090 export { tsFunctionType as tSFunctionType };
2091 export function tsConstructorType(
2092 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
2093 parameters: Array<t.Identifier | t.RestElement>,
2094 typeAnnotation: t.TSTypeAnnotation | null = null,
2095 ): t.TSConstructorType {
2096 return validateNode<t.TSConstructorType>({
2097 type: "TSConstructorType",
2098 typeParameters,
2099 parameters,
2100 typeAnnotation,
2101 });
2102 }
2103 export { tsConstructorType as tSConstructorType };
2104 export function tsTypeReference(
2105 typeName: t.TSEntityName,
2106 typeParameters: t.TSTypeParameterInstantiation | null = null,
2107 ): t.TSTypeReference {
2108 return validateNode<t.TSTypeReference>({
2109 type: "TSTypeReference",
2110 typeName,
2111 typeParameters,
2112 });
2113 }
2114 export { tsTypeReference as tSTypeReference };
2115 export function tsTypePredicate(
2116 parameterName: t.Identifier | t.TSThisType,
2117 typeAnnotation: t.TSTypeAnnotation | null = null,
2118 asserts: boolean | null = null,
2119 ): t.TSTypePredicate {
2120 return validateNode<t.TSTypePredicate>({
2121 type: "TSTypePredicate",
2122 parameterName,
2123 typeAnnotation,
2124 asserts,
2125 });
2126 }
2127 export { tsTypePredicate as tSTypePredicate };
2128 export function tsTypeQuery(
2129 exprName: t.TSEntityName | t.TSImportType,
2130 typeParameters: t.TSTypeParameterInstantiation | null = null,
2131 ): t.TSTypeQuery {
2132 return validateNode<t.TSTypeQuery>({
2133 type: "TSTypeQuery",
2134 exprName,
2135 typeParameters,
2136 });
2137 }
2138 export { tsTypeQuery as tSTypeQuery };
2139 export function tsTypeLiteral(
2140 members: Array<t.TSTypeElement>,
2141 ): t.TSTypeLiteral {
2142 return validateNode<t.TSTypeLiteral>({
2143 type: "TSTypeLiteral",
2144 members,
2145 });
2146 }
2147 export { tsTypeLiteral as tSTypeLiteral };
2148 export function tsArrayType(elementType: t.TSType): t.TSArrayType {
2149 return validateNode<t.TSArrayType>({
2150 type: "TSArrayType",
2151 elementType,
2152 });
2153 }
2154 export { tsArrayType as tSArrayType };
2155 export function tsTupleType(
2156 elementTypes: Array<t.TSType | t.TSNamedTupleMember>,
2157 ): t.TSTupleType {
2158 return validateNode<t.TSTupleType>({
2159 type: "TSTupleType",
2160 elementTypes,
2161 });
2162 }
2163 export { tsTupleType as tSTupleType };
2164 export function tsOptionalType(typeAnnotation: t.TSType): t.TSOptionalType {
2165 return validateNode<t.TSOptionalType>({
2166 type: "TSOptionalType",
2167 typeAnnotation,
2168 });
2169 }
2170 export { tsOptionalType as tSOptionalType };
2171 export function tsRestType(typeAnnotation: t.TSType): t.TSRestType {
2172 return validateNode<t.TSRestType>({
2173 type: "TSRestType",
2174 typeAnnotation,
2175 });
2176 }
2177 export { tsRestType as tSRestType };
2178 export function tsNamedTupleMember(
2179 label: t.Identifier,
2180 elementType: t.TSType,
2181 optional: boolean = false,
2182 ): t.TSNamedTupleMember {
2183 return validateNode<t.TSNamedTupleMember>({
2184 type: "TSNamedTupleMember",
2185 label,
2186 elementType,
2187 optional,
2188 });
2189 }
2190 export { tsNamedTupleMember as tSNamedTupleMember };
2191 export function tsUnionType(types: Array<t.TSType>): t.TSUnionType {
2192 return validateNode<t.TSUnionType>({
2193 type: "TSUnionType",
2194 types,
2195 });
2196 }
2197 export { tsUnionType as tSUnionType };
2198 export function tsIntersectionType(
2199 types: Array<t.TSType>,
2200 ): t.TSIntersectionType {
2201 return validateNode<t.TSIntersectionType>({
2202 type: "TSIntersectionType",
2203 types,
2204 });
2205 }
2206 export { tsIntersectionType as tSIntersectionType };
2207 export function tsConditionalType(
2208 checkType: t.TSType,
2209 extendsType: t.TSType,
2210 trueType: t.TSType,
2211 falseType: t.TSType,
2212 ): t.TSConditionalType {
2213 return validateNode<t.TSConditionalType>({
2214 type: "TSConditionalType",
2215 checkType,
2216 extendsType,
2217 trueType,
2218 falseType,
2219 });
2220 }
2221 export { tsConditionalType as tSConditionalType };
2222 export function tsInferType(typeParameter: t.TSTypeParameter): t.TSInferType {
2223 return validateNode<t.TSInferType>({
2224 type: "TSInferType",
2225 typeParameter,
2226 });
2227 }
2228 export { tsInferType as tSInferType };
2229 export function tsParenthesizedType(
2230 typeAnnotation: t.TSType,
2231 ): t.TSParenthesizedType {
2232 return validateNode<t.TSParenthesizedType>({
2233 type: "TSParenthesizedType",
2234 typeAnnotation,
2235 });
2236 }
2237 export { tsParenthesizedType as tSParenthesizedType };
2238 export function tsTypeOperator(typeAnnotation: t.TSType): t.TSTypeOperator {
2239 return validateNode<t.TSTypeOperator>({
2240 type: "TSTypeOperator",
2241 typeAnnotation,
2242 operator: null,
2243 });
2244 }
2245 export { tsTypeOperator as tSTypeOperator };
2246 export function tsIndexedAccessType(
2247 objectType: t.TSType,
2248 indexType: t.TSType,
2249 ): t.TSIndexedAccessType {
2250 return validateNode<t.TSIndexedAccessType>({
2251 type: "TSIndexedAccessType",
2252 objectType,
2253 indexType,
2254 });
2255 }
2256 export { tsIndexedAccessType as tSIndexedAccessType };
2257 export function tsMappedType(
2258 typeParameter: t.TSTypeParameter,
2259 typeAnnotation: t.TSType | null = null,
2260 nameType: t.TSType | null = null,
2261 ): t.TSMappedType {
2262 return validateNode<t.TSMappedType>({
2263 type: "TSMappedType",
2264 typeParameter,
2265 typeAnnotation,
2266 nameType,
2267 });
2268 }
2269 export { tsMappedType as tSMappedType };
2270 export function tsLiteralType(
2271 literal:
2272 | t.NumericLiteral
2273 | t.StringLiteral
2274 | t.BooleanLiteral
2275 | t.BigIntLiteral
2276 | t.TemplateLiteral
2277 | t.UnaryExpression,
2278 ): t.TSLiteralType {
2279 return validateNode<t.TSLiteralType>({
2280 type: "TSLiteralType",
2281 literal,
2282 });
2283 }
2284 export { tsLiteralType as tSLiteralType };
2285 export function tsExpressionWithTypeArguments(
2286 expression: t.TSEntityName,
2287 typeParameters: t.TSTypeParameterInstantiation | null = null,
2288 ): t.TSExpressionWithTypeArguments {
2289 return validateNode<t.TSExpressionWithTypeArguments>({
2290 type: "TSExpressionWithTypeArguments",
2291 expression,
2292 typeParameters,
2293 });
2294 }
2295 export { tsExpressionWithTypeArguments as tSExpressionWithTypeArguments };
2296 export function tsInterfaceDeclaration(
2297 id: t.Identifier,
2298 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
2299 _extends: Array<t.TSExpressionWithTypeArguments> | null | undefined = null,
2300 body: t.TSInterfaceBody,
2301 ): t.TSInterfaceDeclaration {
2302 return validateNode<t.TSInterfaceDeclaration>({
2303 type: "TSInterfaceDeclaration",
2304 id,
2305 typeParameters,
2306 extends: _extends,
2307 body,
2308 });
2309 }
2310 export { tsInterfaceDeclaration as tSInterfaceDeclaration };
2311 export function tsInterfaceBody(
2312 body: Array<t.TSTypeElement>,
2313 ): t.TSInterfaceBody {
2314 return validateNode<t.TSInterfaceBody>({
2315 type: "TSInterfaceBody",
2316 body,
2317 });
2318 }
2319 export { tsInterfaceBody as tSInterfaceBody };
2320 export function tsTypeAliasDeclaration(
2321 id: t.Identifier,
2322 typeParameters: t.TSTypeParameterDeclaration | null | undefined = null,
2323 typeAnnotation: t.TSType,
2324 ): t.TSTypeAliasDeclaration {
2325 return validateNode<t.TSTypeAliasDeclaration>({
2326 type: "TSTypeAliasDeclaration",
2327 id,
2328 typeParameters,
2329 typeAnnotation,
2330 });
2331 }
2332 export { tsTypeAliasDeclaration as tSTypeAliasDeclaration };
2333 export function tsInstantiationExpression(
2334 expression: t.Expression,
2335 typeParameters: t.TSTypeParameterInstantiation | null = null,
2336 ): t.TSInstantiationExpression {
2337 return validateNode<t.TSInstantiationExpression>({
2338 type: "TSInstantiationExpression",
2339 expression,
2340 typeParameters,
2341 });
2342 }
2343 export { tsInstantiationExpression as tSInstantiationExpression };
2344 export function tsAsExpression(
2345 expression: t.Expression,
2346 typeAnnotation: t.TSType,
2347 ): t.TSAsExpression {
2348 return validateNode<t.TSAsExpression>({
2349 type: "TSAsExpression",
2350 expression,
2351 typeAnnotation,
2352 });
2353 }
2354 export { tsAsExpression as tSAsExpression };
2355 export function tsSatisfiesExpression(
2356 expression: t.Expression,
2357 typeAnnotation: t.TSType,
2358 ): t.TSSatisfiesExpression {
2359 return validateNode<t.TSSatisfiesExpression>({
2360 type: "TSSatisfiesExpression",
2361 expression,
2362 typeAnnotation,
2363 });
2364 }
2365 export { tsSatisfiesExpression as tSSatisfiesExpression };
2366 export function tsTypeAssertion(
2367 typeAnnotation: t.TSType,
2368 expression: t.Expression,
2369 ): t.TSTypeAssertion {
2370 return validateNode<t.TSTypeAssertion>({
2371 type: "TSTypeAssertion",
2372 typeAnnotation,
2373 expression,
2374 });
2375 }
2376 export { tsTypeAssertion as tSTypeAssertion };
2377 export function tsEnumDeclaration(
2378 id: t.Identifier,
2379 members: Array<t.TSEnumMember>,
2380 ): t.TSEnumDeclaration {
2381 return validateNode<t.TSEnumDeclaration>({
2382 type: "TSEnumDeclaration",
2383 id,
2384 members,
2385 });
2386 }
2387 export { tsEnumDeclaration as tSEnumDeclaration };
2388 export function tsEnumMember(
2389 id: t.Identifier | t.StringLiteral,
2390 initializer: t.Expression | null = null,
2391 ): t.TSEnumMember {
2392 return validateNode<t.TSEnumMember>({
2393 type: "TSEnumMember",
2394 id,
2395 initializer,
2396 });
2397 }
2398 export { tsEnumMember as tSEnumMember };
2399 export function tsModuleDeclaration(
2400 id: t.Identifier | t.StringLiteral,
2401 body: t.TSModuleBlock | t.TSModuleDeclaration,
2402 ): t.TSModuleDeclaration {
2403 return validateNode<t.TSModuleDeclaration>({
2404 type: "TSModuleDeclaration",
2405 id,
2406 body,
2407 });
2408 }
2409 export { tsModuleDeclaration as tSModuleDeclaration };
2410 export function tsModuleBlock(body: Array<t.Statement>): t.TSModuleBlock {
2411 return validateNode<t.TSModuleBlock>({
2412 type: "TSModuleBlock",
2413 body,
2414 });
2415 }
2416 export { tsModuleBlock as tSModuleBlock };
2417 export function tsImportType(
2418 argument: t.StringLiteral,
2419 qualifier: t.TSEntityName | null = null,
2420 typeParameters: t.TSTypeParameterInstantiation | null = null,
2421 ): t.TSImportType {
2422 return validateNode<t.TSImportType>({
2423 type: "TSImportType",
2424 argument,
2425 qualifier,
2426 typeParameters,
2427 });
2428 }
2429 export { tsImportType as tSImportType };
2430 export function tsImportEqualsDeclaration(
2431 id: t.Identifier,
2432 moduleReference: t.TSEntityName | t.TSExternalModuleReference,
2433 ): t.TSImportEqualsDeclaration {
2434 return validateNode<t.TSImportEqualsDeclaration>({
2435 type: "TSImportEqualsDeclaration",
2436 id,
2437 moduleReference,
2438 isExport: null,
2439 });
2440 }
2441 export { tsImportEqualsDeclaration as tSImportEqualsDeclaration };
2442 export function tsExternalModuleReference(
2443 expression: t.StringLiteral,
2444 ): t.TSExternalModuleReference {
2445 return validateNode<t.TSExternalModuleReference>({
2446 type: "TSExternalModuleReference",
2447 expression,
2448 });
2449 }
2450 export { tsExternalModuleReference as tSExternalModuleReference };
2451 export function tsNonNullExpression(
2452 expression: t.Expression,
2453 ): t.TSNonNullExpression {
2454 return validateNode<t.TSNonNullExpression>({
2455 type: "TSNonNullExpression",
2456 expression,
2457 });
2458 }
2459 export { tsNonNullExpression as tSNonNullExpression };
2460 export function tsExportAssignment(
2461 expression: t.Expression,
2462 ): t.TSExportAssignment {
2463 return validateNode<t.TSExportAssignment>({
2464 type: "TSExportAssignment",
2465 expression,
2466 });
2467 }
2468 export { tsExportAssignment as tSExportAssignment };
2469 export function tsNamespaceExportDeclaration(
2470 id: t.Identifier,
2471 ): t.TSNamespaceExportDeclaration {
2472 return validateNode<t.TSNamespaceExportDeclaration>({
2473 type: "TSNamespaceExportDeclaration",
2474 id,
2475 });
2476 }
2477 export { tsNamespaceExportDeclaration as tSNamespaceExportDeclaration };
2478 export function tsTypeAnnotation(typeAnnotation: t.TSType): t.TSTypeAnnotation {
2479 return validateNode<t.TSTypeAnnotation>({
2480 type: "TSTypeAnnotation",
2481 typeAnnotation,
2482 });
2483 }
2484 export { tsTypeAnnotation as tSTypeAnnotation };
2485 export function tsTypeParameterInstantiation(
2486 params: Array<t.TSType>,
2487 ): t.TSTypeParameterInstantiation {
2488 return validateNode<t.TSTypeParameterInstantiation>({
2489 type: "TSTypeParameterInstantiation",
2490 params,
2491 });
2492 }
2493 export { tsTypeParameterInstantiation as tSTypeParameterInstantiation };
2494 export function tsTypeParameterDeclaration(
2495 params: Array<t.TSTypeParameter>,
2496 ): t.TSTypeParameterDeclaration {
2497 return validateNode<t.TSTypeParameterDeclaration>({
2498 type: "TSTypeParameterDeclaration",
2499 params,
2500 });
2501 }
2502 export { tsTypeParameterDeclaration as tSTypeParameterDeclaration };
2503 export function tsTypeParameter(
2504 constraint: t.TSType | null | undefined = null,
2505 _default: t.TSType | null | undefined = null,
2506 name: string,
2507 ): t.TSTypeParameter {
2508 return validateNode<t.TSTypeParameter>({
2509 type: "TSTypeParameter",
2510 constraint,
2511 default: _default,
2512 name,
2513 });
2514 }
2515 export { tsTypeParameter as tSTypeParameter };
2516 /** @deprecated */
2517 function NumberLiteral(value: number) {
2518 console.trace(
2519 "The node type NumberLiteral has been renamed to NumericLiteral",
2520 );
2521 return numericLiteral(value);
2522 }
2523 export { NumberLiteral as numberLiteral };
2524 /** @deprecated */
2525 function RegexLiteral(pattern: string, flags: string = "") {
2526 console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
2527 return regExpLiteral(pattern, flags);
2528 }
2529 export { RegexLiteral as regexLiteral };
2530 /** @deprecated */
2531 function RestProperty(argument: t.LVal) {
2532 console.trace("The node type RestProperty has been renamed to RestElement");
2533 return restElement(argument);
2534 }
2535 export { RestProperty as restProperty };
2536 /** @deprecated */
2537 function SpreadProperty(argument: t.Expression) {
2538 console.trace(
2539 "The node type SpreadProperty has been renamed to SpreadElement",
2540 );
2541 return spreadElement(argument);
2542 }
2543 export { SpreadProperty as spreadProperty };