yuku-ast 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,641 @@
1
+ import * as t from "yuku-parser";
2
+ import { BigIntLiteral, BindingIdentifier, BooleanLiteral, ComputedMemberExpression, Directive, IdentifierName, IdentifierReference, LabelIdentifier, Node, NullLiteral, NumericLiteral, PrivateFieldExpression, RegExpLiteral, StaticMemberExpression, StringLiteral } from "yuku-parser";
3
+
4
+ //#region src/types.d.ts
5
+ /** Discriminant `type` string of every AST node. */
6
+ type NodeType = Node["type"];
7
+ /** The node, or union of nodes, carrying a given `type`. */
8
+ type NodeOfType<K extends NodeType> = Extract<Node, {
9
+ type: K;
10
+ }>;
11
+ /** Field names of a node whose values hold child nodes. */
12
+ type ChildKeys<N> = { [K in keyof N]-?: [NonNullable<N[K]>] extends [never] ? never : NonNullable<N[K]> extends Node ? K : NonNullable<N[K]> extends readonly (infer E)[] ? NonNullable<E> extends Node ? K : never : never }[keyof N];
13
+ /**
14
+ * A node's position in the tree, passed to every visitor. It exposes the
15
+ * surrounding context and the operations for changing the tree. Each node has
16
+ * its own path, so a path stays valid after its visit returns.
17
+ */
18
+ interface Path<T extends Node = Node, S = unknown> {
19
+ /** The node being visited. */
20
+ readonly node: T;
21
+ /** The node that holds {@link node}, or null at the root. */
22
+ readonly parent: Node | null;
23
+ /** The field on {@link parent} that holds {@link node} or its array, or null at the root. */
24
+ readonly key: string | null;
25
+ /** Index of {@link node} within an array field, or null when it sits in a plain field. */
26
+ readonly index: number | null;
27
+ /** Ancestors from the root down to {@link parent}, excluding {@link node}. */
28
+ readonly ancestors: readonly Node[];
29
+ /** State threaded through the walk. */
30
+ state: S;
31
+ /** Do not descend into the current node's children. */
32
+ skip(): void;
33
+ /** Stop the walk entirely. */
34
+ stop(): void;
35
+ /** Replace the current node, then walk the replacement's children. */
36
+ replace(next: Node): void;
37
+ /** Remove the current node from its parent. */
38
+ remove(): void;
39
+ /** Insert a sibling before the current node. Only valid in an array field. */
40
+ insertBefore(node: Node): void;
41
+ /** Insert a sibling after the current node. Only valid in an array field. */
42
+ insertAfter(node: Node): void;
43
+ }
44
+ /** Handler invoked with a node and the {@link Path} cursor. */
45
+ type VisitFn<T extends Node, S> = (node: T, path: Path<T, S>) => void;
46
+ /** A visitor: a function run on enter, or an object with `enter` and/or `leave`. */
47
+ type Visitor<T extends Node, S> = VisitFn<T, S> | {
48
+ enter?: VisitFn<T, S>;
49
+ leave?: VisitFn<T, S>;
50
+ };
51
+ /**
52
+ * Visitors passed to {@link walk}. A key may be a node `type`, an alias group
53
+ * such as `Function` or `Expression`, or `enter`/`leave` to match every node.
54
+ */
55
+ type Visitors<S = unknown> = { [K in NodeType]?: Visitor<NodeOfType<K>, S> } & { [K in keyof AliasMap]?: Visitor<AliasMap[K], S> } & {
56
+ enter?: VisitFn<Node, S>;
57
+ leave?: VisitFn<Node, S>;
58
+ };
59
+ /** Like {@link VisitFn}, but may return a promise that the walk awaits. */
60
+ type AsyncVisitFn<T extends Node, S> = (node: T, path: Path<T, S>) => void | Promise<void>;
61
+ /** A visitor for {@link walkAsync}: a function, or an object with `enter` and/or `leave`. */
62
+ type AsyncVisitor<T extends Node, S> = AsyncVisitFn<T, S> | {
63
+ enter?: AsyncVisitFn<T, S>;
64
+ leave?: AsyncVisitFn<T, S>;
65
+ };
66
+ /** Visitors passed to {@link walkAsync}. Shaped like {@link Visitors}, with awaitable handlers. */
67
+ type AsyncVisitors<S = unknown> = { [K in NodeType]?: AsyncVisitor<NodeOfType<K>, S> } & { [K in keyof AliasMap]?: AsyncVisitor<AliasMap[K], S> } & {
68
+ enter?: AsyncVisitFn<Node, S>;
69
+ leave?: AsyncVisitFn<Node, S>;
70
+ };
71
+ //#endregion
72
+ //#region src/aliases.d.ts
73
+ /**
74
+ * Node types grouped under a shared alias. A visitor registered under an alias
75
+ * name runs for every member type. Membership is by node `type`.
76
+ */
77
+ declare const ALIAS_GROUPS: {
78
+ readonly Expression: readonly ["Identifier", "Literal", "ThisExpression", "Super", "ArrayExpression", "ObjectExpression", "FunctionExpression", "ArrowFunctionExpression", "ClassExpression", "TaggedTemplateExpression", "TemplateLiteral", "MemberExpression", "CallExpression", "NewExpression", "ChainExpression", "SequenceExpression", "ParenthesizedExpression", "BinaryExpression", "LogicalExpression", "ConditionalExpression", "UnaryExpression", "UpdateExpression", "AssignmentExpression", "YieldExpression", "AwaitExpression", "ImportExpression", "MetaProperty", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "JSXElement", "JSXFragment"];
79
+ readonly Statement: readonly ["ExpressionStatement", "BlockStatement", "EmptyStatement", "DebuggerStatement", "ReturnStatement", "LabeledStatement", "BreakStatement", "ContinueStatement", "IfStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "WhileStatement", "DoWhileStatement", "ForStatement", "ForInStatement", "ForOfStatement", "WithStatement", "FunctionDeclaration", "ClassDeclaration", "VariableDeclaration", "TSDeclareFunction", "TSTypeAliasDeclaration", "TSInterfaceDeclaration", "TSEnumDeclaration", "TSModuleDeclaration", "TSImportEqualsDeclaration"];
80
+ readonly Declaration: readonly ["FunctionDeclaration", "ClassDeclaration", "VariableDeclaration", "TSDeclareFunction", "TSTypeAliasDeclaration", "TSInterfaceDeclaration", "TSEnumDeclaration", "TSModuleDeclaration", "TSImportEqualsDeclaration"];
81
+ readonly ModuleDeclaration: readonly ["ImportDeclaration", "ExportNamedDeclaration", "ExportDefaultDeclaration", "ExportAllDeclaration", "TSExportAssignment", "TSNamespaceExportDeclaration"];
82
+ readonly Function: readonly ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression", "TSDeclareFunction", "TSEmptyBodyFunctionExpression"];
83
+ readonly Class: readonly ["ClassDeclaration", "ClassExpression"];
84
+ readonly Method: readonly ["MethodDefinition", "TSAbstractMethodDefinition"];
85
+ readonly Loop: readonly ["ForStatement", "ForInStatement", "ForOfStatement", "WhileStatement", "DoWhileStatement"];
86
+ readonly Pattern: readonly ["Identifier", "ArrayPattern", "ObjectPattern", "AssignmentPattern", "RestElement"];
87
+ readonly JSX: readonly ["JSXElement", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXAttribute", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXEmptyExpression", "JSXText", "JSXSpreadChild"];
88
+ readonly TSType: readonly ["TSAnyKeyword", "TSUnknownKeyword", "TSNeverKeyword", "TSVoidKeyword", "TSNullKeyword", "TSUndefinedKeyword", "TSStringKeyword", "TSNumberKeyword", "TSBigIntKeyword", "TSBooleanKeyword", "TSSymbolKeyword", "TSObjectKeyword", "TSIntrinsicKeyword", "TSThisType", "TSTypeReference", "TSTypeQuery", "TSImportType", "TSLiteralType", "TSTemplateLiteralType", "TSArrayType", "TSIndexedAccessType", "TSTupleType", "TSNamedTupleMember", "TSJSDocNullableType", "TSJSDocNonNullableType", "TSJSDocUnknownType", "TSUnionType", "TSIntersectionType", "TSConditionalType", "TSInferType", "TSTypeOperator", "TSParenthesizedType", "TSFunctionType", "TSConstructorType", "TSTypePredicate", "TSTypeLiteral", "TSMappedType"];
89
+ };
90
+ /** Name of an alias group. */
91
+ type AliasName = keyof typeof ALIAS_GROUPS;
92
+ /** Node union matched by each alias group. */
93
+ type AliasMap = { [K in AliasName]: NodeOfType<(typeof ALIAS_GROUPS)[K][number]> };
94
+ //#endregion
95
+ //#region src/predicates.d.ts
96
+ type MaybeNode = Node | null | undefined;
97
+ declare const is: {
98
+ Expression: (node: MaybeNode) => node is NodeOfType<"Identifier" | "Literal" | "ThisExpression" | "Super" | "ArrayExpression" | "ObjectExpression" | "FunctionExpression" | "ArrowFunctionExpression" | "ClassExpression" | "TaggedTemplateExpression" | "TemplateLiteral" | "MemberExpression" | "CallExpression" | "NewExpression" | "ChainExpression" | "SequenceExpression" | "ParenthesizedExpression" | "BinaryExpression" | "LogicalExpression" | "ConditionalExpression" | "UnaryExpression" | "UpdateExpression" | "AssignmentExpression" | "YieldExpression" | "AwaitExpression" | "ImportExpression" | "MetaProperty" | "TSAsExpression" | "TSSatisfiesExpression" | "TSTypeAssertion" | "TSNonNullExpression" | "TSInstantiationExpression" | "JSXElement" | "JSXFragment">;
99
+ Statement: (node: MaybeNode) => node is AliasMap["Statement"];
100
+ Declaration: (node: MaybeNode) => node is AliasMap["Declaration"];
101
+ ModuleDeclaration: (node: MaybeNode) => node is AliasMap["ModuleDeclaration"];
102
+ Function: (node: MaybeNode) => node is AliasMap["Function"];
103
+ Class: (node: MaybeNode) => node is AliasMap["Class"];
104
+ Method: (node: MaybeNode) => node is AliasMap["Method"];
105
+ Loop: (node: MaybeNode) => node is AliasMap["Loop"];
106
+ Pattern: (node: MaybeNode) => node is AliasMap["Pattern"];
107
+ JSX: (node: MaybeNode) => node is AliasMap["JSX"];
108
+ TSType: (node: MaybeNode) => node is AliasMap["TSType"];
109
+ IdentifierReference: (node: MaybeNode) => node is IdentifierReference;
110
+ BindingIdentifier: (node: MaybeNode) => node is BindingIdentifier;
111
+ LabelIdentifier: (node: MaybeNode) => node is LabelIdentifier;
112
+ IdentifierName: (node: MaybeNode) => node is IdentifierName;
113
+ StringLiteral: (node: MaybeNode) => node is StringLiteral;
114
+ NumericLiteral: (node: MaybeNode) => node is NumericLiteral;
115
+ BooleanLiteral: (node: MaybeNode) => node is BooleanLiteral;
116
+ NullLiteral: (node: MaybeNode) => node is NullLiteral;
117
+ BigIntLiteral: (node: MaybeNode) => node is BigIntLiteral;
118
+ RegExpLiteral: (node: MaybeNode) => node is RegExpLiteral;
119
+ ComputedMemberExpression: (node: MaybeNode) => node is ComputedMemberExpression;
120
+ StaticMemberExpression: (node: MaybeNode) => node is StaticMemberExpression;
121
+ PrivateFieldExpression: (node: MaybeNode) => node is PrivateFieldExpression;
122
+ Directive: (node: MaybeNode) => node is Directive;
123
+ Program: (node: MaybeNode) => node is import("yuku-parser").Program;
124
+ Hashbang: (node: MaybeNode) => node is import("yuku-parser").Hashbang;
125
+ ExpressionStatement: (node: MaybeNode) => node is NodeOfType<"ExpressionStatement">;
126
+ BlockStatement: (node: MaybeNode) => node is import("yuku-parser").BlockStatement;
127
+ EmptyStatement: (node: MaybeNode) => node is import("yuku-parser").EmptyStatement;
128
+ DebuggerStatement: (node: MaybeNode) => node is import("yuku-parser").DebuggerStatement;
129
+ ReturnStatement: (node: MaybeNode) => node is import("yuku-parser").ReturnStatement;
130
+ LabeledStatement: (node: MaybeNode) => node is import("yuku-parser").LabeledStatement;
131
+ BreakStatement: (node: MaybeNode) => node is import("yuku-parser").BreakStatement;
132
+ ContinueStatement: (node: MaybeNode) => node is import("yuku-parser").ContinueStatement;
133
+ IfStatement: (node: MaybeNode) => node is import("yuku-parser").IfStatement;
134
+ SwitchStatement: (node: MaybeNode) => node is import("yuku-parser").SwitchStatement;
135
+ ThrowStatement: (node: MaybeNode) => node is import("yuku-parser").ThrowStatement;
136
+ TryStatement: (node: MaybeNode) => node is import("yuku-parser").TryStatement;
137
+ WhileStatement: (node: MaybeNode) => node is import("yuku-parser").WhileStatement;
138
+ DoWhileStatement: (node: MaybeNode) => node is import("yuku-parser").DoWhileStatement;
139
+ ForStatement: (node: MaybeNode) => node is import("yuku-parser").ForStatement;
140
+ ForInStatement: (node: MaybeNode) => node is import("yuku-parser").ForInStatement;
141
+ ForOfStatement: (node: MaybeNode) => node is import("yuku-parser").ForOfStatement;
142
+ WithStatement: (node: MaybeNode) => node is import("yuku-parser").WithStatement;
143
+ FunctionDeclaration: (node: MaybeNode) => node is import("yuku-parser").FunctionDeclaration;
144
+ ClassDeclaration: (node: MaybeNode) => node is import("yuku-parser").ClassDeclaration;
145
+ VariableDeclaration: (node: MaybeNode) => node is import("yuku-parser").VariableDeclaration;
146
+ TSDeclareFunction: (node: MaybeNode) => node is import("yuku-parser").TSDeclareFunction;
147
+ TSTypeAliasDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSTypeAliasDeclaration;
148
+ TSInterfaceDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSInterfaceDeclaration;
149
+ TSEnumDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSEnumDeclaration;
150
+ TSModuleDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSModuleDeclaration;
151
+ TSImportEqualsDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSImportEqualsDeclaration;
152
+ Identifier: (node: MaybeNode) => node is import("yuku-parser").Identifier;
153
+ Literal: (node: MaybeNode) => node is NodeOfType<"Literal">;
154
+ ThisExpression: (node: MaybeNode) => node is import("yuku-parser").ThisExpression;
155
+ Super: (node: MaybeNode) => node is import("yuku-parser").Super;
156
+ ArrayExpression: (node: MaybeNode) => node is import("yuku-parser").ArrayExpression;
157
+ ObjectExpression: (node: MaybeNode) => node is import("yuku-parser").ObjectExpression;
158
+ FunctionExpression: (node: MaybeNode) => node is import("yuku-parser").FunctionExpression;
159
+ ArrowFunctionExpression: (node: MaybeNode) => node is import("yuku-parser").ArrowFunctionExpression;
160
+ ClassExpression: (node: MaybeNode) => node is import("yuku-parser").ClassExpression;
161
+ TaggedTemplateExpression: (node: MaybeNode) => node is import("yuku-parser").TaggedTemplateExpression;
162
+ TemplateLiteral: (node: MaybeNode) => node is import("yuku-parser").TemplateLiteral;
163
+ MemberExpression: (node: MaybeNode) => node is NodeOfType<"MemberExpression">;
164
+ CallExpression: (node: MaybeNode) => node is import("yuku-parser").CallExpression;
165
+ NewExpression: (node: MaybeNode) => node is import("yuku-parser").NewExpression;
166
+ ChainExpression: (node: MaybeNode) => node is import("yuku-parser").ChainExpression;
167
+ SequenceExpression: (node: MaybeNode) => node is import("yuku-parser").SequenceExpression;
168
+ ParenthesizedExpression: (node: MaybeNode) => node is import("yuku-parser").ParenthesizedExpression;
169
+ BinaryExpression: (node: MaybeNode) => node is import("yuku-parser").BinaryExpression;
170
+ LogicalExpression: (node: MaybeNode) => node is import("yuku-parser").LogicalExpression;
171
+ ConditionalExpression: (node: MaybeNode) => node is import("yuku-parser").ConditionalExpression;
172
+ UnaryExpression: (node: MaybeNode) => node is import("yuku-parser").UnaryExpression;
173
+ UpdateExpression: (node: MaybeNode) => node is import("yuku-parser").UpdateExpression;
174
+ AssignmentExpression: (node: MaybeNode) => node is import("yuku-parser").AssignmentExpression;
175
+ YieldExpression: (node: MaybeNode) => node is import("yuku-parser").YieldExpression;
176
+ AwaitExpression: (node: MaybeNode) => node is import("yuku-parser").AwaitExpression;
177
+ ImportExpression: (node: MaybeNode) => node is import("yuku-parser").ImportExpression;
178
+ MetaProperty: (node: MaybeNode) => node is import("yuku-parser").MetaProperty;
179
+ TSAsExpression: (node: MaybeNode) => node is import("yuku-parser").TSAsExpression;
180
+ TSSatisfiesExpression: (node: MaybeNode) => node is import("yuku-parser").TSSatisfiesExpression;
181
+ TSTypeAssertion: (node: MaybeNode) => node is import("yuku-parser").TSTypeAssertion;
182
+ TSNonNullExpression: (node: MaybeNode) => node is import("yuku-parser").TSNonNullExpression;
183
+ TSInstantiationExpression: (node: MaybeNode) => node is import("yuku-parser").TSInstantiationExpression;
184
+ JSXElement: (node: MaybeNode) => node is import("yuku-parser").JSXElement;
185
+ JSXFragment: (node: MaybeNode) => node is import("yuku-parser").JSXFragment;
186
+ ImportDeclaration: (node: MaybeNode) => node is import("yuku-parser").ImportDeclaration;
187
+ ExportNamedDeclaration: (node: MaybeNode) => node is import("yuku-parser").ExportNamedDeclaration;
188
+ ExportDefaultDeclaration: (node: MaybeNode) => node is import("yuku-parser").ExportDefaultDeclaration;
189
+ ExportAllDeclaration: (node: MaybeNode) => node is import("yuku-parser").ExportAllDeclaration;
190
+ TSExportAssignment: (node: MaybeNode) => node is import("yuku-parser").TSExportAssignment;
191
+ TSNamespaceExportDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSNamespaceExportDeclaration;
192
+ Property: (node: MaybeNode) => node is NodeOfType<"Property">;
193
+ SpreadElement: (node: MaybeNode) => node is import("yuku-parser").SpreadElement;
194
+ PrivateIdentifier: (node: MaybeNode) => node is import("yuku-parser").PrivateIdentifier;
195
+ TemplateElement: (node: MaybeNode) => node is import("yuku-parser").TemplateElement;
196
+ VariableDeclarator: (node: MaybeNode) => node is import("yuku-parser").VariableDeclarator;
197
+ CatchClause: (node: MaybeNode) => node is import("yuku-parser").CatchClause;
198
+ SwitchCase: (node: MaybeNode) => node is import("yuku-parser").SwitchCase;
199
+ RestElement: (node: MaybeNode) => node is import("yuku-parser").RestElement;
200
+ ArrayPattern: (node: MaybeNode) => node is import("yuku-parser").ArrayPattern;
201
+ ObjectPattern: (node: MaybeNode) => node is import("yuku-parser").ObjectPattern;
202
+ AssignmentPattern: (node: MaybeNode) => node is import("yuku-parser").AssignmentPattern;
203
+ ClassBody: (node: MaybeNode) => node is import("yuku-parser").ClassBody;
204
+ MethodDefinition: (node: MaybeNode) => node is import("yuku-parser").MethodDefinition;
205
+ TSAbstractMethodDefinition: (node: MaybeNode) => node is import("yuku-parser").TSAbstractMethodDefinition;
206
+ PropertyDefinition: (node: MaybeNode) => node is import("yuku-parser").PropertyDefinition;
207
+ TSAbstractPropertyDefinition: (node: MaybeNode) => node is import("yuku-parser").TSAbstractPropertyDefinition;
208
+ AccessorProperty: (node: MaybeNode) => node is import("yuku-parser").AccessorProperty;
209
+ TSAbstractAccessorProperty: (node: MaybeNode) => node is import("yuku-parser").TSAbstractAccessorProperty;
210
+ StaticBlock: (node: MaybeNode) => node is import("yuku-parser").StaticBlock;
211
+ Decorator: (node: MaybeNode) => node is import("yuku-parser").Decorator;
212
+ TSEmptyBodyFunctionExpression: (node: MaybeNode) => node is import("yuku-parser").TSEmptyBodyFunctionExpression;
213
+ ImportSpecifier: (node: MaybeNode) => node is import("yuku-parser").ImportSpecifier;
214
+ ImportDefaultSpecifier: (node: MaybeNode) => node is import("yuku-parser").ImportDefaultSpecifier;
215
+ ImportNamespaceSpecifier: (node: MaybeNode) => node is import("yuku-parser").ImportNamespaceSpecifier;
216
+ ImportAttribute: (node: MaybeNode) => node is import("yuku-parser").ImportAttribute;
217
+ ExportSpecifier: (node: MaybeNode) => node is import("yuku-parser").ExportSpecifier;
218
+ JSXOpeningElement: (node: MaybeNode) => node is import("yuku-parser").JSXOpeningElement;
219
+ JSXClosingElement: (node: MaybeNode) => node is import("yuku-parser").JSXClosingElement;
220
+ JSXOpeningFragment: (node: MaybeNode) => node is import("yuku-parser").JSXOpeningFragment;
221
+ JSXClosingFragment: (node: MaybeNode) => node is import("yuku-parser").JSXClosingFragment;
222
+ JSXIdentifier: (node: MaybeNode) => node is import("yuku-parser").JSXIdentifier;
223
+ JSXNamespacedName: (node: MaybeNode) => node is import("yuku-parser").JSXNamespacedName;
224
+ JSXMemberExpression: (node: MaybeNode) => node is import("yuku-parser").JSXMemberExpression;
225
+ JSXAttribute: (node: MaybeNode) => node is import("yuku-parser").JSXAttribute;
226
+ JSXSpreadAttribute: (node: MaybeNode) => node is import("yuku-parser").JSXSpreadAttribute;
227
+ JSXExpressionContainer: (node: MaybeNode) => node is import("yuku-parser").JSXExpressionContainer;
228
+ JSXEmptyExpression: (node: MaybeNode) => node is import("yuku-parser").JSXEmptyExpression;
229
+ JSXText: (node: MaybeNode) => node is import("yuku-parser").JSXText;
230
+ JSXSpreadChild: (node: MaybeNode) => node is import("yuku-parser").JSXSpreadChild;
231
+ TSTypeAnnotation: (node: MaybeNode) => node is import("yuku-parser").TSTypeAnnotation;
232
+ TSAnyKeyword: (node: MaybeNode) => node is import("yuku-parser").TSAnyKeyword;
233
+ TSUnknownKeyword: (node: MaybeNode) => node is import("yuku-parser").TSUnknownKeyword;
234
+ TSNeverKeyword: (node: MaybeNode) => node is import("yuku-parser").TSNeverKeyword;
235
+ TSVoidKeyword: (node: MaybeNode) => node is import("yuku-parser").TSVoidKeyword;
236
+ TSNullKeyword: (node: MaybeNode) => node is import("yuku-parser").TSNullKeyword;
237
+ TSUndefinedKeyword: (node: MaybeNode) => node is import("yuku-parser").TSUndefinedKeyword;
238
+ TSStringKeyword: (node: MaybeNode) => node is import("yuku-parser").TSStringKeyword;
239
+ TSNumberKeyword: (node: MaybeNode) => node is import("yuku-parser").TSNumberKeyword;
240
+ TSBigIntKeyword: (node: MaybeNode) => node is import("yuku-parser").TSBigIntKeyword;
241
+ TSBooleanKeyword: (node: MaybeNode) => node is import("yuku-parser").TSBooleanKeyword;
242
+ TSSymbolKeyword: (node: MaybeNode) => node is import("yuku-parser").TSSymbolKeyword;
243
+ TSObjectKeyword: (node: MaybeNode) => node is import("yuku-parser").TSObjectKeyword;
244
+ TSIntrinsicKeyword: (node: MaybeNode) => node is import("yuku-parser").TSIntrinsicKeyword;
245
+ TSThisType: (node: MaybeNode) => node is import("yuku-parser").TSThisType;
246
+ TSTypeReference: (node: MaybeNode) => node is import("yuku-parser").TSTypeReference;
247
+ TSTypeQuery: (node: MaybeNode) => node is import("yuku-parser").TSTypeQuery;
248
+ TSImportType: (node: MaybeNode) => node is import("yuku-parser").TSImportType;
249
+ TSLiteralType: (node: MaybeNode) => node is import("yuku-parser").TSLiteralType;
250
+ TSTemplateLiteralType: (node: MaybeNode) => node is import("yuku-parser").TSTemplateLiteralType;
251
+ TSArrayType: (node: MaybeNode) => node is import("yuku-parser").TSArrayType;
252
+ TSIndexedAccessType: (node: MaybeNode) => node is import("yuku-parser").TSIndexedAccessType;
253
+ TSTupleType: (node: MaybeNode) => node is import("yuku-parser").TSTupleType;
254
+ TSNamedTupleMember: (node: MaybeNode) => node is import("yuku-parser").TSNamedTupleMember;
255
+ TSJSDocNullableType: (node: MaybeNode) => node is import("yuku-parser").TSJSDocNullableType;
256
+ TSJSDocNonNullableType: (node: MaybeNode) => node is import("yuku-parser").TSJSDocNonNullableType;
257
+ TSJSDocUnknownType: (node: MaybeNode) => node is import("yuku-parser").TSJSDocUnknownType;
258
+ TSUnionType: (node: MaybeNode) => node is import("yuku-parser").TSUnionType;
259
+ TSIntersectionType: (node: MaybeNode) => node is import("yuku-parser").TSIntersectionType;
260
+ TSConditionalType: (node: MaybeNode) => node is import("yuku-parser").TSConditionalType;
261
+ TSInferType: (node: MaybeNode) => node is import("yuku-parser").TSInferType;
262
+ TSTypeOperator: (node: MaybeNode) => node is import("yuku-parser").TSTypeOperator;
263
+ TSParenthesizedType: (node: MaybeNode) => node is import("yuku-parser").TSParenthesizedType;
264
+ TSFunctionType: (node: MaybeNode) => node is import("yuku-parser").TSFunctionType;
265
+ TSConstructorType: (node: MaybeNode) => node is import("yuku-parser").TSConstructorType;
266
+ TSTypePredicate: (node: MaybeNode) => node is import("yuku-parser").TSTypePredicate;
267
+ TSTypeLiteral: (node: MaybeNode) => node is import("yuku-parser").TSTypeLiteral;
268
+ TSMappedType: (node: MaybeNode) => node is import("yuku-parser").TSMappedType;
269
+ TSTypeParameter: (node: MaybeNode) => node is import("yuku-parser").TSTypeParameter;
270
+ TSTypeParameterDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSTypeParameterDeclaration;
271
+ TSTypeParameterInstantiation: (node: MaybeNode) => node is import("yuku-parser").TSTypeParameterInstantiation;
272
+ TSQualifiedName: (node: MaybeNode) => node is import("yuku-parser").TSQualifiedName;
273
+ TSPropertySignature: (node: MaybeNode) => node is import("yuku-parser").TSPropertySignature;
274
+ TSMethodSignature: (node: MaybeNode) => node is import("yuku-parser").TSMethodSignature;
275
+ TSCallSignatureDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSCallSignatureDeclaration;
276
+ TSConstructSignatureDeclaration: (node: MaybeNode) => node is import("yuku-parser").TSConstructSignatureDeclaration;
277
+ TSIndexSignature: (node: MaybeNode) => node is import("yuku-parser").TSIndexSignature;
278
+ TSInterfaceBody: (node: MaybeNode) => node is import("yuku-parser").TSInterfaceBody;
279
+ TSInterfaceHeritage: (node: MaybeNode) => node is import("yuku-parser").TSInterfaceHeritage;
280
+ TSClassImplements: (node: MaybeNode) => node is import("yuku-parser").TSClassImplements;
281
+ TSEnumBody: (node: MaybeNode) => node is import("yuku-parser").TSEnumBody;
282
+ TSEnumMember: (node: MaybeNode) => node is import("yuku-parser").TSEnumMember;
283
+ TSModuleBlock: (node: MaybeNode) => node is import("yuku-parser").TSModuleBlock;
284
+ TSParameterProperty: (node: MaybeNode) => node is import("yuku-parser").TSParameterProperty;
285
+ TSExternalModuleReference: (node: MaybeNode) => node is import("yuku-parser").TSExternalModuleReference;
286
+ TSOptionalType: (node: MaybeNode) => node is import("yuku-parser").TSOptionalType;
287
+ TSRestType: (node: MaybeNode) => node is import("yuku-parser").TSRestType;
288
+ };
289
+ //#endregion
290
+ //#region src/builders.d.ts
291
+ declare const b: {
292
+ identifier(name: string, kind?: t.IdentifierKind, opts?: {
293
+ typeAnnotation?: t.TSTypeAnnotation | null;
294
+ optional?: boolean;
295
+ decorators?: t.Decorator[];
296
+ }): t.Identifier;
297
+ privateIdentifier(name: string): t.PrivateIdentifier;
298
+ stringLiteral(value: string): t.StringLiteral;
299
+ numericLiteral(value: number): t.NumericLiteral;
300
+ booleanLiteral(value: boolean): t.BooleanLiteral;
301
+ nullLiteral(): t.NullLiteral;
302
+ bigIntLiteral(value: bigint): t.BigIntLiteral;
303
+ regExpLiteral(pattern: string, flags?: string): t.RegExpLiteral;
304
+ templateLiteral(quasis: t.TemplateElement[], expressions: t.Expression[]): t.TemplateLiteral;
305
+ templateElement(cooked: string, tail?: boolean): t.TemplateElement;
306
+ thisExpression(): t.ThisExpression;
307
+ super(): t.Super;
308
+ arrayPattern(elements: Array<t.BindingPattern | t.RestElement | null>): t.ArrayPattern;
309
+ objectPattern(properties: Array<t.BindingProperty | t.RestElement>): t.ObjectPattern;
310
+ assignmentPattern(left: t.BindingPattern, right: t.Expression): t.AssignmentPattern;
311
+ restElement(argument: t.BindingPattern): t.RestElement; /** A member of an `ObjectExpression`. For an `ObjectPattern` member, use {@link bindingProperty}. */
312
+ objectProperty(key: t.PropertyKey, value: t.Expression, opts?: {
313
+ computed?: boolean;
314
+ shorthand?: boolean;
315
+ kind?: t.PropertyKind;
316
+ method?: boolean;
317
+ }): t.ObjectProperty; /** A member of an `ObjectPattern`, whose value is a binding target. For an `ObjectExpression` member, use {@link objectProperty}. */
318
+ bindingProperty(key: t.PropertyKey, value: t.BindingPattern, opts?: {
319
+ computed?: boolean;
320
+ shorthand?: boolean;
321
+ }): t.BindingProperty;
322
+ arrayExpression(elements?: t.ArrayExpressionElement[]): t.ArrayExpression;
323
+ objectExpression(properties?: t.ObjectPropertyKind[]): t.ObjectExpression;
324
+ spreadElement(argument: t.Expression): t.SpreadElement;
325
+ sequenceExpression(expressions: t.Expression[]): t.SequenceExpression;
326
+ parenthesizedExpression(expression: t.Expression): t.ParenthesizedExpression;
327
+ unaryExpression(operator: t.UnaryOperator, argument: t.Expression): t.UnaryExpression;
328
+ updateExpression(operator: t.UpdateOperator, argument: t.Expression, prefix?: boolean): t.UpdateExpression;
329
+ binaryExpression(operator: t.BinaryOperator, left: t.Expression | t.PrivateIdentifier, right: t.Expression): t.BinaryExpression;
330
+ logicalExpression(operator: t.LogicalOperator, left: t.Expression, right: t.Expression): t.LogicalExpression;
331
+ assignmentExpression(operator: t.AssignmentOperator, left: t.AssignmentTarget, right: t.Expression): t.AssignmentExpression;
332
+ conditionalExpression(test: t.Expression, consequent: t.Expression, alternate: t.Expression): t.ConditionalExpression;
333
+ yieldExpression(argument?: t.Expression | null, delegate?: boolean): t.YieldExpression;
334
+ awaitExpression(argument: t.Expression): t.AwaitExpression;
335
+ memberExpression(object: t.Expression | t.Super, property: t.Expression | t.IdentifierName | t.PrivateIdentifier, opts?: {
336
+ computed?: boolean;
337
+ optional?: boolean;
338
+ }): t.MemberExpression;
339
+ callExpression(callee: t.Expression | t.Super, args?: t.Argument[], opts?: {
340
+ optional?: boolean;
341
+ typeArguments?: t.TSTypeParameterInstantiation | null;
342
+ }): t.CallExpression;
343
+ newExpression(callee: t.Expression, args?: t.Argument[], opts?: {
344
+ typeArguments?: t.TSTypeParameterInstantiation | null;
345
+ }): t.NewExpression;
346
+ chainExpression(expression: t.ChainElement): t.ChainExpression;
347
+ taggedTemplateExpression(tag: t.Expression, quasi: t.TemplateLiteral, opts?: {
348
+ typeArguments?: t.TSTypeParameterInstantiation | null;
349
+ }): t.TaggedTemplateExpression;
350
+ metaProperty(meta: string, property: string): t.MetaProperty;
351
+ importExpression(source: t.Expression, opts?: {
352
+ options?: t.Expression | null;
353
+ phase?: t.ImportPhase | null;
354
+ }): t.ImportExpression;
355
+ arrowFunctionExpression(params: t.FunctionParameter[], body: t.BlockStatement | t.Expression, opts?: {
356
+ async?: boolean;
357
+ typeParameters?: t.TSTypeParameterDeclaration | null;
358
+ returnType?: t.TSTypeAnnotation | null;
359
+ }): t.ArrowFunctionExpression;
360
+ functionExpression(params: t.FunctionParameter[], body: t.BlockStatement, opts?: {
361
+ id?: t.Identifier | null;
362
+ async?: boolean;
363
+ generator?: boolean;
364
+ }): t.FunctionExpression;
365
+ functionDeclaration(id: t.Identifier | null, params: t.FunctionParameter[], body: t.BlockStatement | null, opts?: {
366
+ async?: boolean;
367
+ generator?: boolean;
368
+ }): t.FunctionDeclaration;
369
+ classDeclaration(id: t.Identifier | null, body: t.ClassBody, opts?: {
370
+ superClass?: t.Expression | null;
371
+ decorators?: t.Decorator[];
372
+ typeParameters?: t.TSTypeParameterDeclaration | null;
373
+ abstract?: boolean;
374
+ }): t.ClassDeclaration;
375
+ classExpression(id: t.Identifier | null, body: t.ClassBody, opts?: {
376
+ superClass?: t.Expression | null;
377
+ decorators?: t.Decorator[];
378
+ }): t.ClassExpression;
379
+ classBody(body?: t.ClassElement[]): t.ClassBody;
380
+ methodDefinition(key: t.PropertyKey, value: t.FunctionExpression | t.TSEmptyBodyFunctionExpression, opts?: {
381
+ kind?: t.MethodDefinitionKind;
382
+ computed?: boolean;
383
+ static?: boolean;
384
+ }): t.MethodDefinition;
385
+ propertyDefinition(key: t.PropertyKey, value?: t.Expression | null, opts?: {
386
+ computed?: boolean;
387
+ static?: boolean;
388
+ decorators?: t.Decorator[];
389
+ }): t.PropertyDefinition;
390
+ accessorProperty(key: t.PropertyKey, value?: t.Expression | null, opts?: {
391
+ computed?: boolean;
392
+ static?: boolean;
393
+ }): t.AccessorProperty;
394
+ tsAbstractMethodDefinition(key: t.PropertyKey, value: t.FunctionExpression | t.TSEmptyBodyFunctionExpression, opts?: {
395
+ kind?: t.MethodDefinitionKind;
396
+ computed?: boolean;
397
+ static?: boolean;
398
+ }): t.TSAbstractMethodDefinition;
399
+ tsAbstractPropertyDefinition(key: t.PropertyKey, value?: t.Expression | null, opts?: {
400
+ computed?: boolean;
401
+ static?: boolean;
402
+ }): t.TSAbstractPropertyDefinition;
403
+ tsAbstractAccessorProperty(key: t.PropertyKey, value?: t.Expression | null, opts?: {
404
+ computed?: boolean;
405
+ static?: boolean;
406
+ }): t.TSAbstractAccessorProperty;
407
+ staticBlock(body?: t.Statement[]): t.StaticBlock;
408
+ decorator(expression: t.Expression): t.Decorator;
409
+ expressionStatement(expression: t.Expression): t.ExpressionStatement;
410
+ directive(value: string): t.Directive;
411
+ blockStatement(body?: t.Statement[]): t.BlockStatement;
412
+ emptyStatement(): t.EmptyStatement;
413
+ debuggerStatement(): t.DebuggerStatement;
414
+ returnStatement(argument?: t.Expression | null): t.ReturnStatement;
415
+ ifStatement(test: t.Expression, consequent: t.Statement, alternate?: t.Statement | null): t.IfStatement;
416
+ switchStatement(discriminant: t.Expression, cases: t.SwitchCase[]): t.SwitchStatement;
417
+ switchCase(test: t.Expression | null, consequent: t.Statement[]): t.SwitchCase;
418
+ throwStatement(argument: t.Expression): t.ThrowStatement;
419
+ tryStatement(block: t.BlockStatement, handler?: t.CatchClause | null, finalizer?: t.BlockStatement | null): t.TryStatement;
420
+ catchClause(param: t.BindingPattern | null, body: t.BlockStatement): t.CatchClause;
421
+ whileStatement(test: t.Expression, body: t.Statement): t.WhileStatement;
422
+ doWhileStatement(body: t.Statement, test: t.Expression): t.DoWhileStatement;
423
+ forStatement(init: t.ForStatementInit | null, test: t.Expression | null, update: t.Expression | null, body: t.Statement): t.ForStatement;
424
+ forInStatement(left: t.ForStatementLeft, right: t.Expression, body: t.Statement): t.ForInStatement;
425
+ forOfStatement(left: t.ForStatementLeft, right: t.Expression, body: t.Statement, isAwait?: boolean): t.ForOfStatement;
426
+ labeledStatement(label: t.LabelIdentifier, body: t.Statement): t.LabeledStatement;
427
+ breakStatement(label?: t.LabelIdentifier | null): t.BreakStatement;
428
+ continueStatement(label?: t.LabelIdentifier | null): t.ContinueStatement;
429
+ withStatement(object: t.Expression, body: t.Statement): t.WithStatement;
430
+ variableDeclaration(kind: t.VariableDeclarationKind, declarations: t.VariableDeclarator[]): t.VariableDeclaration;
431
+ variableDeclarator(id: t.BindingPattern, init?: t.Expression | null): t.VariableDeclarator;
432
+ importDeclaration(specifiers: t.ImportDeclarationSpecifier[], source: t.StringLiteral, opts?: {
433
+ attributes?: t.ImportAttribute[];
434
+ phase?: t.ImportPhase | null;
435
+ importKind?: t.ImportOrExportKind;
436
+ }): t.ImportDeclaration;
437
+ importSpecifier(imported: t.IdentifierName | t.StringLiteral, local: t.BindingIdentifier): t.ImportSpecifier;
438
+ importDefaultSpecifier(local: t.BindingIdentifier): t.ImportDefaultSpecifier;
439
+ importNamespaceSpecifier(local: t.BindingIdentifier): t.ImportNamespaceSpecifier;
440
+ importAttribute(key: t.ImportAttributeKey, value: t.StringLiteral): t.ImportAttribute;
441
+ exportNamedDeclaration(declaration: t.Declaration | null, specifiers?: t.ExportSpecifier[], opts?: {
442
+ source?: t.StringLiteral | null;
443
+ attributes?: t.ImportAttribute[];
444
+ exportKind?: t.ImportOrExportKind;
445
+ }): t.ExportNamedDeclaration;
446
+ exportDefaultDeclaration(declaration: t.ExportDefaultDeclarationKind): t.ExportDefaultDeclaration;
447
+ exportAllDeclaration(source: t.StringLiteral, opts?: {
448
+ exported?: t.ModuleExportName | null;
449
+ attributes?: t.ImportAttribute[];
450
+ exportKind?: t.ImportOrExportKind;
451
+ }): t.ExportAllDeclaration;
452
+ exportSpecifier(local: t.ModuleExportName, exported: t.ModuleExportName): t.ExportSpecifier;
453
+ jsxIdentifier(name: string): t.JSXIdentifier;
454
+ jsxNamespacedName(namespace: t.JSXIdentifier, name: t.JSXIdentifier): t.JSXNamespacedName;
455
+ jsxMemberExpression(object: t.JSXMemberExpressionObject, property: t.JSXIdentifier): t.JSXMemberExpression;
456
+ jsxElement(openingElement: t.JSXOpeningElement, children?: t.JSXChild[], closingElement?: t.JSXClosingElement | null): t.JSXElement;
457
+ jsxOpeningElement(name: t.JSXElementName, attributes?: t.JSXAttributeItem[], selfClosing?: boolean): t.JSXOpeningElement;
458
+ jsxClosingElement(name: t.JSXElementName): t.JSXClosingElement;
459
+ jsxOpeningFragment(): t.JSXOpeningFragment;
460
+ jsxClosingFragment(): t.JSXClosingFragment;
461
+ jsxFragment(children?: t.JSXChild[]): t.JSXFragment;
462
+ jsxAttribute(name: t.JSXAttributeName, value?: t.JSXAttributeValue | null): t.JSXAttribute;
463
+ jsxSpreadAttribute(argument: t.Expression): t.JSXSpreadAttribute;
464
+ jsxExpressionContainer(expression: t.JSXExpression): t.JSXExpressionContainer;
465
+ jsxEmptyExpression(): t.JSXEmptyExpression;
466
+ jsxText(value: string): t.JSXText;
467
+ jsxSpreadChild(expression: t.Expression): t.JSXSpreadChild;
468
+ tsTypeAnnotation(typeAnnotation: t.TSType): t.TSTypeAnnotation;
469
+ tsAnyKeyword: () => t.TSAnyKeyword;
470
+ tsUnknownKeyword: () => t.TSUnknownKeyword;
471
+ tsNeverKeyword: () => t.TSNeverKeyword;
472
+ tsVoidKeyword: () => t.TSVoidKeyword;
473
+ tsNullKeyword: () => t.TSNullKeyword;
474
+ tsUndefinedKeyword: () => t.TSUndefinedKeyword;
475
+ tsStringKeyword: () => t.TSStringKeyword;
476
+ tsNumberKeyword: () => t.TSNumberKeyword;
477
+ tsBigIntKeyword: () => t.TSBigIntKeyword;
478
+ tsBooleanKeyword: () => t.TSBooleanKeyword;
479
+ tsSymbolKeyword: () => t.TSSymbolKeyword;
480
+ tsObjectKeyword: () => t.TSObjectKeyword;
481
+ tsIntrinsicKeyword: () => t.TSIntrinsicKeyword;
482
+ tsThisType: () => t.TSThisType;
483
+ tsTypeReference(typeName: t.TSTypeName, typeArguments?: t.TSTypeParameterInstantiation | null): t.TSTypeReference;
484
+ tsQualifiedName(left: t.TSTypeName, right: t.IdentifierName): t.TSQualifiedName;
485
+ tsTypeQuery(exprName: t.TSTypeQueryExprName, typeArguments?: t.TSTypeParameterInstantiation | null): t.TSTypeQuery;
486
+ tsImportType(source: t.StringLiteral, opts?: {
487
+ options?: t.ObjectExpression | null;
488
+ qualifier?: t.TSImportTypeQualifier | null;
489
+ typeArguments?: t.TSTypeParameterInstantiation | null;
490
+ }): t.TSImportType;
491
+ tsTypeParameter(name: t.BindingIdentifier, opts?: {
492
+ constraint?: t.TSType | null;
493
+ default?: t.TSType | null;
494
+ in?: boolean;
495
+ out?: boolean;
496
+ const?: boolean;
497
+ }): t.TSTypeParameter;
498
+ tsTypeParameterDeclaration(params: t.TSTypeParameter[]): t.TSTypeParameterDeclaration;
499
+ tsTypeParameterInstantiation(params: t.TSType[]): t.TSTypeParameterInstantiation;
500
+ tsLiteralType(literal: t.TSLiteralType["literal"]): t.TSLiteralType;
501
+ tsTemplateLiteralType(quasis: t.TemplateElement[], types: t.TSType[]): t.TSTemplateLiteralType;
502
+ tsArrayType(elementType: t.TSType): t.TSArrayType;
503
+ tsIndexedAccessType(objectType: t.TSType, indexType: t.TSType): t.TSIndexedAccessType;
504
+ tsTupleType(elementTypes: t.TSTupleElement[]): t.TSTupleType;
505
+ tsNamedTupleMember(label: t.IdentifierName, elementType: t.TSType, optional?: boolean): t.TSNamedTupleMember;
506
+ tsOptionalType(typeAnnotation: t.TSType): t.TSOptionalType;
507
+ tsRestType(typeAnnotation: t.TSType | t.TSNamedTupleMember): t.TSRestType;
508
+ tsJSDocNullableType(typeAnnotation: t.TSType, postfix?: boolean): t.TSJSDocNullableType;
509
+ tsJSDocNonNullableType(typeAnnotation: t.TSType, postfix?: boolean): t.TSJSDocNonNullableType;
510
+ tsJSDocUnknownType(): t.TSJSDocUnknownType;
511
+ tsUnionType(types: t.TSType[]): t.TSUnionType;
512
+ tsIntersectionType(types: t.TSType[]): t.TSIntersectionType;
513
+ tsConditionalType(checkType: t.TSType, extendsType: t.TSType, trueType: t.TSType, falseType: t.TSType): t.TSConditionalType;
514
+ tsInferType(typeParameter: t.TSTypeParameter): t.TSInferType;
515
+ tsTypeOperator(operator: t.TSTypeOperator["operator"], typeAnnotation: t.TSType): t.TSTypeOperator;
516
+ tsParenthesizedType(typeAnnotation: t.TSType): t.TSParenthesizedType;
517
+ tsFunctionType(params: t.FunctionParameter[], returnType: t.TSTypeAnnotation | null, typeParameters?: t.TSTypeParameterDeclaration | null): t.TSFunctionType;
518
+ tsConstructorType(params: t.FunctionParameter[], returnType: t.TSTypeAnnotation | null, opts?: {
519
+ abstract?: boolean;
520
+ typeParameters?: t.TSTypeParameterDeclaration | null;
521
+ }): t.TSConstructorType;
522
+ tsTypePredicate(parameterName: t.TSTypePredicateName, typeAnnotation?: t.TSTypeAnnotation | null, asserts?: boolean): t.TSTypePredicate;
523
+ tsTypeLiteral(members: t.TSSignature[]): t.TSTypeLiteral;
524
+ tsMappedType(key: t.BindingIdentifier, constraint: t.TSType, opts?: {
525
+ nameType?: t.TSType | null;
526
+ typeAnnotation?: t.TSType | null;
527
+ optional?: t.TSMappedTypeModifierOperator | false;
528
+ readonly?: t.TSMappedTypeModifierOperator | null;
529
+ }): t.TSMappedType;
530
+ tsPropertySignature(key: t.PropertyKey, opts?: {
531
+ typeAnnotation?: t.TSTypeAnnotation | null;
532
+ computed?: boolean;
533
+ optional?: boolean;
534
+ readonly?: boolean;
535
+ }): t.TSPropertySignature;
536
+ tsMethodSignature(key: t.PropertyKey, params: t.FunctionParameter[], opts?: {
537
+ kind?: t.TSMethodSignatureKind;
538
+ computed?: boolean;
539
+ optional?: boolean;
540
+ typeParameters?: t.TSTypeParameterDeclaration | null;
541
+ returnType?: t.TSTypeAnnotation | null;
542
+ }): t.TSMethodSignature;
543
+ tsCallSignatureDeclaration(params: t.FunctionParameter[], returnType?: t.TSTypeAnnotation | null, typeParameters?: t.TSTypeParameterDeclaration | null): t.TSCallSignatureDeclaration;
544
+ tsConstructSignatureDeclaration(params: t.FunctionParameter[], returnType?: t.TSTypeAnnotation | null, typeParameters?: t.TSTypeParameterDeclaration | null): t.TSConstructSignatureDeclaration;
545
+ tsIndexSignature(parameters: t.BindingIdentifier[], typeAnnotation: t.TSTypeAnnotation, opts?: {
546
+ readonly?: boolean;
547
+ static?: boolean;
548
+ }): t.TSIndexSignature;
549
+ tsTypeAliasDeclaration(id: t.BindingIdentifier, typeAnnotation: t.TSType, opts?: {
550
+ typeParameters?: t.TSTypeParameterDeclaration | null;
551
+ declare?: boolean;
552
+ }): t.TSTypeAliasDeclaration;
553
+ tsInterfaceDeclaration(id: t.BindingIdentifier, body: t.TSInterfaceBody, opts?: {
554
+ extends?: t.TSInterfaceHeritage[];
555
+ typeParameters?: t.TSTypeParameterDeclaration | null;
556
+ declare?: boolean;
557
+ }): t.TSInterfaceDeclaration;
558
+ tsInterfaceBody(body: t.TSSignature[]): t.TSInterfaceBody;
559
+ tsInterfaceHeritage(expression: t.Expression, typeArguments?: t.TSTypeParameterInstantiation | null): t.TSInterfaceHeritage;
560
+ tsClassImplements(expression: t.Expression, typeArguments?: t.TSTypeParameterInstantiation | null): t.TSClassImplements;
561
+ tsEnumDeclaration(id: t.BindingIdentifier, body: t.TSEnumBody, opts?: {
562
+ const?: boolean;
563
+ declare?: boolean;
564
+ }): t.TSEnumDeclaration;
565
+ tsEnumBody(members: t.TSEnumMember[]): t.TSEnumBody;
566
+ tsEnumMember(id: t.TSEnumMemberName, initializer?: t.Expression | null): t.TSEnumMember;
567
+ tsModuleDeclaration(id: t.TSModuleDeclaration["id"], body: t.TSModuleBlock | undefined, opts?: {
568
+ kind?: t.TSModuleDeclarationKind;
569
+ declare?: boolean;
570
+ global?: boolean;
571
+ }): t.TSModuleDeclaration;
572
+ tsModuleBlock(body?: t.Statement[]): t.TSModuleBlock;
573
+ tsParameterProperty(parameter: t.BindingIdentifier | t.AssignmentPattern, opts?: {
574
+ accessibility?: t.TSAccessibility | null;
575
+ readonly?: boolean;
576
+ override?: boolean;
577
+ decorators?: t.Decorator[];
578
+ }): t.TSParameterProperty;
579
+ tsAsExpression(expression: t.Expression, typeAnnotation: t.TSType): t.TSAsExpression;
580
+ tsSatisfiesExpression(expression: t.Expression, typeAnnotation: t.TSType): t.TSSatisfiesExpression;
581
+ tsTypeAssertion(typeAnnotation: t.TSType, expression: t.Expression): t.TSTypeAssertion;
582
+ tsNonNullExpression(expression: t.Expression): t.TSNonNullExpression;
583
+ tsInstantiationExpression(expression: t.Expression, typeArguments: t.TSTypeParameterInstantiation): t.TSInstantiationExpression;
584
+ tsExportAssignment(expression: t.Expression): t.TSExportAssignment;
585
+ tsNamespaceExportDeclaration(id: t.IdentifierName): t.TSNamespaceExportDeclaration;
586
+ tsImportEqualsDeclaration(id: t.BindingIdentifier, moduleReference: t.TSModuleReference, importKind?: t.ImportOrExportKind): t.TSImportEqualsDeclaration;
587
+ tsExternalModuleReference(expression: t.StringLiteral): t.TSExternalModuleReference;
588
+ tsDeclareFunction(id: t.BindingIdentifier | null, params: t.FunctionParameter[], opts?: {
589
+ async?: boolean;
590
+ generator?: boolean;
591
+ returnType?: t.TSTypeAnnotation | null;
592
+ typeParameters?: t.TSTypeParameterDeclaration | null;
593
+ declare?: boolean;
594
+ }): t.TSDeclareFunction;
595
+ tsEmptyBodyFunctionExpression(params: t.FunctionParameter[], opts?: {
596
+ id?: t.BindingIdentifier | null;
597
+ returnType?: t.TSTypeAnnotation | null;
598
+ typeParameters?: t.TSTypeParameterDeclaration | null;
599
+ }): t.TSEmptyBodyFunctionExpression;
600
+ hashbang(value: string): t.Hashbang;
601
+ program(body?: Array<t.Statement | t.ModuleDeclaration | t.Directive>, opts?: {
602
+ sourceType?: t.ModuleKind;
603
+ hashbang?: t.Hashbang | null;
604
+ }): t.Program;
605
+ };
606
+ //#endregion
607
+ //#region src/walk/sync.d.ts
608
+ /**
609
+ * Walk an AST depth first, dispatching to typed visitors and mutating in place.
610
+ *
611
+ * @param root The node to start from, usually a `Program`.
612
+ * @param visitors Handlers keyed by node `type`, alias group, or `enter`/`leave`.
613
+ * @param state Optional value exposed as `path.state` throughout the walk.
614
+ * @returns The root node, or its replacement if the root was replaced.
615
+ *
616
+ * @example
617
+ * ```ts
618
+ * walk(program, {
619
+ * Identifier(node) {
620
+ * console.log(node.name);
621
+ * },
622
+ * CallExpression(node, path) {
623
+ * if (node.callee.type === "MemberExpression") path.skip();
624
+ * },
625
+ * });
626
+ * ```
627
+ */
628
+ declare function walk<T extends Node, S = unknown>(root: T, visitors: Visitors<S>, state?: S): T;
629
+ //#endregion
630
+ //#region src/walk/async.d.ts
631
+ /**
632
+ * Like {@link walk}, but visitors may be `async`. Handlers are awaited one at a
633
+ * time in depth-first order, so mutation behaves exactly as in the sync walk.
634
+ * Reach for this only when a visitor needs to await I/O; prefer {@link walk}
635
+ * otherwise, as awaiting has per-node overhead.
636
+ *
637
+ * @returns A promise of the root node, or its replacement if the root was replaced.
638
+ */
639
+ declare function walkAsync<T extends Node, S = unknown>(root: T, visitors: AsyncVisitors<S>, state?: S): Promise<T>;
640
+ //#endregion
641
+ export { type AliasMap, type AliasName, type AsyncVisitFn, type AsyncVisitor, type AsyncVisitors, type ChildKeys, type NodeOfType, type NodeType, type Path, type VisitFn, type Visitor, type Visitors, b, is, walk, walkAsync };