UNPKG

59.9 kBTypeScriptView Raw
1// Type definitions for @babel/traverse 7.17
2// Project: https://github.com/babel/babel/tree/main/packages/babel-traverse, https://babeljs.io
3// Definitions by: Troy Gerwien <https://github.com/yortus>
4// Marvin Hagemeister <https://github.com/marvinhagemeister>
5// Ryan Petrich <https://github.com/rpetrich>
6// Melvin Groenhoff <https://github.com/mgroenhoff>
7// Dean L. <https://github.com/dlgrit>
8// Ifiok Jr. <https://github.com/ifiokjr>
9// ExE Boss <https://github.com/ExE-Boss>
10// Daniel Tschinder <https://github.com/danez>
11// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
12
13import * as t from '@babel/types';
14export import Node = t.Node;
15
16declare const traverse: {
17 <S>(
18 parent: Node | Node[] | null | undefined,
19 opts: TraverseOptions<S>,
20 scope: Scope | undefined,
21 state: S,
22 parentPath?: NodePath,
23 ): void;
24 (
25 parent: Node | Node[] | null | undefined,
26 opts?: TraverseOptions,
27 scope?: Scope,
28 state?: any,
29 parentPath?: NodePath,
30 ): void;
31
32 visitors: typeof visitors;
33 verify: typeof visitors.verify;
34 explode: typeof visitors.explode;
35};
36
37export namespace visitors {
38 /**
39 * `explode()` will take a `Visitor` object with all of the various shorthands
40 * that we support, and validates & normalizes it into a common format, ready
41 * to be used in traversal.
42 *
43 * The various shorthands are:
44 * - `Identifier() { ... }` -> `Identifier: { enter() { ... } }`
45 * - `"Identifier|NumericLiteral": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }`
46 * - Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }`
47 *
48 * Other normalizations are:
49 * - Visitors of virtual types are wrapped, so that they are only visited when their dynamic check passes
50 * - `enter` and `exit` functions are wrapped in arrays, to ease merging of visitors
51 */
52 function explode<S = {}>(
53 visitor: Visitor<S>,
54 ): {
55 [Type in Node['type']]?: VisitNodeObject<S, Extract<Node, { type: Type }>>;
56 };
57 function verify(visitor: Visitor): void;
58 function merge<S = {}>(visitors: Array<Visitor<S>>, states?: S[]): Visitor<unknown>;
59}
60
61export default traverse;
62
63export interface TraverseOptions<S = Node> extends Visitor<S> {
64 scope?: Scope | undefined;
65 noScope?: boolean | undefined;
66}
67
68export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
69
70export class Scope {
71 constructor(path: NodePath, parentScope?: Scope);
72 path: NodePath;
73 block: Node;
74 parentBlock: Node;
75 parent: Scope;
76 hub: HubInterface;
77 bindings: { [name: string]: Binding };
78
79 /** Traverse node with current scope and path. */
80 traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void;
81 traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void;
82
83 /** Generate a unique identifier and add it to the current scope. */
84 generateDeclaredUidIdentifier(name?: string): t.Identifier;
85
86 /** Generate a unique identifier. */
87 generateUidIdentifier(name?: string): t.Identifier;
88
89 /** Generate a unique `_id1` binding. */
90 generateUid(name?: string): string;
91
92 /** Generate a unique identifier based on a node. */
93 generateUidIdentifierBasedOnNode(parent: Node, defaultName?: string): t.Identifier;
94
95 /**
96 * Determine whether evaluating the specific input `node` is a consequenceless reference. ie.
97 * evaluating it wont result in potentially arbitrary code from being ran. The following are
98 * whitelisted and determined not to cause side effects:
99 *
100 * - `this` expressions
101 * - `super` expressions
102 * - Bound identifiers
103 */
104 isStatic(node: Node): boolean;
105
106 /** Possibly generate a memoised identifier if it is not static and has consequences. */
107 maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier;
108
109 checkBlockScopedCollisions(local: Node, kind: string, name: string, id: object): void;
110
111 rename(oldName: string, newName?: string, block?: Node): void;
112
113 dump(): void;
114
115 toArray(node: Node, i?: number): Node;
116
117 registerDeclaration(path: NodePath): void;
118
119 buildUndefinedNode(): Node;
120
121 registerConstantViolation(path: NodePath): void;
122
123 registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void;
124
125 addGlobal(node: Node): void;
126
127 hasUid(name: string): boolean;
128
129 hasGlobal(name: string): boolean;
130
131 hasReference(name: string): boolean;
132
133 isPure(node: Node, constantsOnly?: boolean): boolean;
134
135 setData(key: string, val: any): any;
136
137 getData(key: string): any;
138
139 removeData(key: string): void;
140
141 crawl(): void;
142
143 push(opts: {
144 id: t.LVal;
145 init?: t.Expression | undefined;
146 unique?: boolean | undefined;
147 kind?: 'var' | 'let' | 'const' | undefined;
148 }): void;
149
150 getProgramParent(): Scope;
151
152 getFunctionParent(): Scope | null;
153
154 getBlockParent(): Scope;
155
156 /** Walks the scope tree and gathers **all** bindings. */
157 getAllBindings(...kinds: string[]): object;
158
159 bindingIdentifierEquals(name: string, node: Node): boolean;
160
161 getBinding(name: string): Binding | undefined;
162
163 getOwnBinding(name: string): Binding | undefined;
164
165 getBindingIdentifier(name: string): t.Identifier;
166
167 getOwnBindingIdentifier(name: string): t.Identifier;
168
169 hasOwnBinding(name: string): boolean;
170
171 hasBinding(name: string, noGlobals?: boolean): boolean;
172
173 parentHasBinding(name: string, noGlobals?: boolean): boolean;
174
175 /** Move a binding of `name` to another `scope`. */
176 moveBindingTo(name: string, scope: Scope): void;
177
178 removeOwnBinding(name: string): void;
179
180 removeBinding(name: string): void;
181}
182
183export class Binding {
184 constructor(opts: {
185 existing: Binding;
186 identifier: t.Identifier;
187 scope: Scope;
188 path: NodePath;
189 kind: 'var' | 'let' | 'const';
190 });
191 identifier: t.Identifier;
192 scope: Scope;
193 path: NodePath;
194 kind: 'var' | 'let' | 'const' | 'module';
195 referenced: boolean;
196 references: number;
197 referencePaths: NodePath[];
198 constant: boolean;
199 constantViolations: NodePath[];
200}
201
202export type Visitor<S = {}> = VisitNodeObject<S, Node> & {
203 [Type in Node['type']]?: VisitNode<S, Extract<Node, { type: Type }>>;
204} & {
205 [K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]>;
206};
207
208export type VisitNode<S, P extends Node> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
209
210export type VisitNodeFunction<S, P extends Node> = (this: S, path: NodePath<P>, state: S) => void;
211
212type NodeType = Node['type'] | keyof t.Aliases;
213
214export interface VisitNodeObject<S, P extends Node> {
215 enter?: VisitNodeFunction<S, P> | undefined;
216 exit?: VisitNodeFunction<S, P> | undefined;
217 denylist?: NodeType[] | undefined;
218 /**
219 * @deprecated will be removed in Babel 8
220 */
221 blacklist?: NodeType[] | undefined;
222}
223
224export type NodePaths<T extends Node | readonly Node[]> = T extends readonly Node[]
225 ? { -readonly [K in keyof T]: NodePath<Extract<T[K], Node>> }
226 : T extends Node
227 ? [NodePath<T>]
228 : never;
229
230export class NodePath<T = Node> {
231 constructor(hub: Hub, parent: Node);
232 parent: Node;
233 hub: Hub;
234 contexts: TraversalContext[];
235 data: object;
236 shouldSkip: boolean;
237 shouldStop: boolean;
238 removed: boolean;
239 state: any;
240 opts: object;
241 skipKeys: object;
242 parentPath: T extends t.Program ? null : NodePath;
243 context: TraversalContext;
244 container: object | object[];
245 listKey: string;
246 inList: boolean;
247 parentKey: string;
248 key: string | number;
249 node: T;
250 scope: Scope;
251 type: T extends null | undefined ? undefined : T extends Node ? T['type'] : string | undefined;
252 typeAnnotation: object;
253
254 getScope(scope: Scope): Scope;
255
256 setData(key: string, val: any): any;
257
258 getData(key: string, def?: any): any;
259
260 hasNode(): this is NodePath<NonNullable<this['node']>>;
261
262 buildCodeFrameError<TError extends Error>(msg: string, Error?: new (msg: string) => TError): TError;
263
264 traverse<T>(visitor: Visitor<T>, state: T): void;
265 traverse(visitor: Visitor): void;
266
267 set(key: string, node: Node): void;
268
269 getPathLocation(): string;
270
271 // Example: https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83
272 debug(buildMessage: () => string): void;
273
274 static get<C extends Node, K extends keyof C>(opts: {
275 hub: HubInterface;
276 parentPath: NodePath | null;
277 parent: Node;
278 container: C;
279 listKey?: string | undefined;
280 key: K;
281 }): NodePath<C[K]>;
282
283 //#region ------------------------- ancestry -------------------------
284 /**
285 * Starting at the parent path of the current `NodePath` and going up the
286 * tree, return the first `NodePath` that causes the provided `callback`
287 * to return a truthy value, or `null` if the `callback` never returns a
288 * truthy value.
289 */
290 findParent(callback: (path: NodePath) => boolean): NodePath | null;
291
292 /**
293 * Starting at current `NodePath` and going up the tree, return the first
294 * `NodePath` that causes the provided `callback` to return a truthy value,
295 * or `null` if the `callback` never returns a truthy value.
296 */
297 find(callback: (path: NodePath) => boolean): NodePath | null;
298
299 /** Get the parent function of the current path. */
300 getFunctionParent(): NodePath<t.Function> | null;
301
302 /** Walk up the tree until we hit a parent node path in a list. */
303 getStatementParent(): NodePath<t.Statement> | null;
304
305 /**
306 * Get the deepest common ancestor and then from it, get the earliest relationship path
307 * to that ancestor.
308 *
309 * Earliest is defined as being "before" all the other nodes in terms of list container
310 * position and visiting key.
311 */
312 getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath;
313
314 /** Get the earliest path in the tree where the provided `paths` intersect. */
315 getDeepestCommonAncestorFrom(
316 paths: NodePath[],
317 filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath,
318 ): NodePath;
319
320 /**
321 * Build an array of node paths containing the entire ancestry of the current node path.
322 *
323 * NOTE: The current node path is included in this.
324 */
325 getAncestry(): [this, ...NodePath[]];
326
327 /**
328 * A helper to find if `this` path is an ancestor of `maybeDescendant`
329 */
330 isAncestor(maybeDescendant: NodePath): boolean;
331
332 /**
333 * A helper to find if `this` path is a descendant of `maybeAncestor`
334 */
335 isDescendant(maybeAncestor: NodePath): boolean;
336
337 inType(...candidateTypes: string[]): boolean;
338 //#endregion
339
340 //#region ------------------------- inference -------------------------
341 /** Infer the type of the current `NodePath`. */
342 getTypeAnnotation(): t.FlowType;
343
344 isBaseType(baseName: string, soft?: boolean): boolean;
345
346 couldBeBaseType(name: string): boolean;
347
348 baseTypeStrictlyMatches(right: NodePath): boolean;
349
350 isGenericType(genericName: string): boolean;
351 //#endregion
352
353 //#region ------------------------- replacement -------------------------
354 /**
355 * Replace a node with an array of multiple. This method performs the following steps:
356 *
357 * - Inherit the comments of first provided node with that of the current node.
358 * - Insert the provided nodes after the current node.
359 * - Remove the current node.
360 */
361 replaceWithMultiple<Nodes extends readonly Node[]>(nodes: Nodes): NodePaths<Nodes>;
362
363 /**
364 * Parse a string as an expression and replace the current node with the result.
365 *
366 * NOTE: This is typically not a good idea to use. Building source strings when
367 * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's
368 * easier to use, your transforms will be extremely brittle.
369 */
370 replaceWithSourceString(replacement: any): [NodePath];
371
372 /** Replace the current node with another. */
373 replaceWith<T extends Node>(replacement: T | NodePath<T>): [NodePath<T>];
374
375 /**
376 * This method takes an array of statements nodes and then explodes it
377 * into expressions. This method retains completion records which is
378 * extremely important to retain original semantics.
379 */
380 replaceExpressionWithStatements<Nodes extends readonly Node[]>(nodes: Nodes): NodePaths<Nodes>;
381
382 replaceInline<Nodes extends Node | readonly Node[]>(nodes: Nodes): NodePaths<Nodes>;
383 //#endregion
384
385 //#region ------------------------- evaluation -------------------------
386 /**
387 * Walk the input `node` and statically evaluate if it's truthy.
388 *
389 * Returning `true` when we're sure that the expression will evaluate to a
390 * truthy value, `false` if we're sure that it will evaluate to a falsy
391 * value and `undefined` if we aren't sure. Because of this please do not
392 * rely on coercion when using this method and check with === if it's false.
393 */
394 evaluateTruthy(): boolean;
395
396 /**
397 * Walk the input `node` and statically evaluate it.
398 *
399 * Returns an object in the form `{ confident, value }`. `confident` indicates
400 * whether or not we had to drop out of evaluating the expression because of
401 * hitting an unknown node that we couldn't confidently find the value of.
402 *
403 * Example:
404 *
405 * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 }
406 * t.evaluate(parse("!true")) // { confident: true, value: false }
407 * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined }
408 */
409 evaluate(): { confident: boolean; value: any };
410 //#endregion
411
412 //#region ------------------------- introspection -------------------------
413 /**
414 * Match the current node if it matches the provided `pattern`.
415 *
416 * For example, given the match `React.createClass` it would match the
417 * parsed nodes of `React.createClass` and `React["createClass"]`.
418 */
419 matchesPattern(pattern: string, allowPartial?: boolean): boolean;
420
421 /**
422 * Check whether we have the input `key`. If the `key` references an array then we check
423 * if the array has any items, otherwise we just check if it's falsy.
424 */
425 has(key: string): boolean;
426
427 isStatic(): boolean;
428
429 /** Alias of `has`. */
430 is(key: string): boolean;
431
432 /** Opposite of `has`. */
433 isnt(key: string): boolean;
434
435 /** Check whether the path node `key` strict equals `value`. */
436 equals(key: string, value: any): boolean;
437
438 /**
439 * Check the type against our stored internal type of the node. This is handy when a node has
440 * been removed yet we still internally know the type and need it to calculate node replacement.
441 */
442 isNodeType(type: string): boolean;
443
444 /**
445 * This checks whether or not we're in one of the following positions:
446 *
447 * for (KEY in right);
448 * for (KEY;;);
449 *
450 * This is because these spots allow VariableDeclarations AND normal expressions so we need
451 * to tell the path replacement that it's ok to replace this with an expression.
452 */
453 canHaveVariableDeclarationOrExpression(): boolean;
454
455 /**
456 * This checks whether we are swapping an arrow function's body between an
457 * expression and a block statement (or vice versa).
458 *
459 * This is because arrow functions may implicitly return an expression, which
460 * is the same as containing a block statement.
461 */
462 canSwapBetweenExpressionAndStatement(replacement: Node): boolean;
463
464 /** Check whether the current path references a completion record */
465 isCompletionRecord(allowInsideFunction?: boolean): boolean;
466
467 /**
468 * Check whether or not the current `key` allows either a single statement or block statement
469 * so we can explode it if necessary.
470 */
471 isStatementOrBlock(): boolean;
472
473 /** Check if the currently assigned path references the `importName` of `moduleSource`. */
474 referencesImport(moduleSource: string, importName: string): boolean;
475
476 /** Get the source code associated with this node. */
477 getSource(): string;
478
479 /** Check if the current path will maybe execute before another path */
480 willIMaybeExecuteBefore(path: NodePath): boolean;
481 //#endregion
482
483 //#region ------------------------- context -------------------------
484 call(key: string): boolean;
485
486 isBlacklisted(): boolean;
487
488 visit(): boolean;
489
490 skip(): void;
491
492 skipKey(key: string): void;
493
494 stop(): void;
495
496 setScope(): void;
497
498 setContext(context: TraversalContext): NodePath<T>;
499
500 popContext(): void;
501
502 pushContext(context: TraversalContext): void;
503 //#endregion
504
505 //#region ------------------------- removal -------------------------
506 remove(): void;
507 //#endregion
508
509 //#region ------------------------- modification -------------------------
510 /** Insert the provided nodes before the current one. */
511 insertBefore<Nodes extends Node | readonly Node[]>(nodes: Nodes): NodePaths<Nodes>;
512
513 /**
514 * Insert the provided nodes after the current one. When inserting nodes after an
515 * expression, ensure that the completion record is correct by pushing the current node.
516 */
517 insertAfter<Nodes extends Node | readonly Node[]>(nodes: Nodes): NodePaths<Nodes>;
518
519 /** Update all sibling node paths after `fromIndex` by `incrementBy`. */
520 updateSiblingKeys(fromIndex: number, incrementBy: number): void;
521
522 /**
523 * Insert child nodes at the start of the current node.
524 * @param listKey - The key at which the child nodes are stored (usually body).
525 * @param nodes - the nodes to insert.
526 */
527 unshiftContainer<Nodes extends Node | readonly Node[]>(listKey: ArrayKeys<T>, nodes: Nodes): NodePaths<Nodes>;
528
529 /**
530 * Insert child nodes at the end of the current node.
531 * @param listKey - The key at which the child nodes are stored (usually body).
532 * @param nodes - the nodes to insert.
533 */
534 pushContainer<Nodes extends Node | readonly Node[]>(listKey: ArrayKeys<T>, nodes: Nodes): NodePaths<Nodes>;
535
536 /** Hoist the current node to the highest scope possible and return a UID referencing it. */
537 hoist(scope: Scope): void;
538 //#endregion
539
540 //#region ------------------------- family -------------------------
541 getOpposite(): NodePath;
542
543 getCompletionRecords(): NodePath[];
544
545 getSibling(key: string | number): NodePath;
546 getPrevSibling(): NodePath;
547 getNextSibling(): NodePath;
548 getAllPrevSiblings(): NodePath[];
549 getAllNextSiblings(): NodePath[];
550
551 get<K extends keyof T>(
552 key: K,
553 context?: boolean | TraversalContext,
554 ): T[K] extends Array<Node | null | undefined>
555 ? Array<NodePath<T[K][number]>>
556 : T[K] extends Array<Node | null | undefined> | null | undefined
557 ? Array<NodePath<NonNullable<T[K]>[number]>> | NodePath<null | undefined>
558 : T[K] extends Node | null | undefined
559 ? NodePath<T[K]>
560 : never;
561 get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[];
562
563 getBindingIdentifiers(duplicates?: boolean): Node[];
564
565 getOuterBindingIdentifiers(duplicates?: boolean): Node[];
566 //#endregion
567
568 //#region ------------------------- comments -------------------------
569 /** Share comments amongst siblings. */
570 shareCommentsWithSiblings(): void;
571
572 addComment(type: string, content: string, line?: boolean): void;
573
574 /** Give node `comments` of the specified `type`. */
575 addComments(type: string, comments: any[]): void;
576 //#endregion
577
578 //#region ------------------------- isXXX -------------------------
579 isAnyTypeAnnotation(props?: object | null): this is NodePath<t.AnyTypeAnnotation>;
580 isArrayExpression(props?: object | null): this is NodePath<t.ArrayExpression>;
581 isArrayPattern(props?: object | null): this is NodePath<t.ArrayPattern>;
582 isArrayTypeAnnotation(props?: object | null): this is NodePath<t.ArrayTypeAnnotation>;
583 isArrowFunctionExpression(props?: object | null): this is NodePath<t.ArrowFunctionExpression>;
584 isAssignmentExpression(props?: object | null): this is NodePath<t.AssignmentExpression>;
585 isAssignmentPattern(props?: object | null): this is NodePath<t.AssignmentPattern>;
586 isAwaitExpression(props?: object | null): this is NodePath<t.AwaitExpression>;
587 isBigIntLiteral(props?: object | null): this is NodePath<t.BigIntLiteral>;
588 isBinary(props?: object | null): this is NodePath<t.Binary>;
589 isBinaryExpression(props?: object | null): this is NodePath<t.BinaryExpression>;
590 isBindExpression(props?: object | null): this is NodePath<t.BindExpression>;
591 isBlock(props?: object | null): this is NodePath<t.Block>;
592 isBlockParent(props?: object | null): this is NodePath<t.BlockParent>;
593 isBlockStatement(props?: object | null): this is NodePath<t.BlockStatement>;
594 isBooleanLiteral(props?: object | null): this is NodePath<t.BooleanLiteral>;
595 isBooleanLiteralTypeAnnotation(props?: object | null): this is NodePath<t.BooleanLiteralTypeAnnotation>;
596 isBooleanTypeAnnotation(props?: object | null): this is NodePath<t.BooleanTypeAnnotation>;
597 isBreakStatement(props?: object | null): this is NodePath<t.BreakStatement>;
598 isCallExpression(props?: object | null): this is NodePath<t.CallExpression>;
599 isCatchClause(props?: object | null): this is NodePath<t.CatchClause>;
600 isClass(props?: object | null): this is NodePath<t.Class>;
601 isClassBody(props?: object | null): this is NodePath<t.ClassBody>;
602 isClassDeclaration(props?: object | null): this is NodePath<t.ClassDeclaration>;
603 isClassExpression(props?: object | null): this is NodePath<t.ClassExpression>;
604 isClassImplements(props?: object | null): this is NodePath<t.ClassImplements>;
605 isClassMethod(props?: object | null): this is NodePath<t.ClassMethod>;
606 isClassPrivateMethod(props?: object | null): this is NodePath<t.ClassPrivateMethod>;
607 isClassPrivateProperty(props?: object | null): this is NodePath<t.ClassPrivateProperty>;
608 isClassProperty(props?: object | null): this is NodePath<t.ClassProperty>;
609 isCompletionStatement(props?: object | null): this is NodePath<t.CompletionStatement>;
610 isConditional(props?: object | null): this is NodePath<t.Conditional>;
611 isConditionalExpression(props?: object | null): this is NodePath<t.ConditionalExpression>;
612 isContinueStatement(props?: object | null): this is NodePath<t.ContinueStatement>;
613 isDebuggerStatement(props?: object | null): this is NodePath<t.DebuggerStatement>;
614 isDeclaration(props?: object | null): this is NodePath<t.Declaration>;
615 isDeclareClass(props?: object | null): this is NodePath<t.DeclareClass>;
616 isDeclareExportAllDeclaration(props?: object | null): this is NodePath<t.DeclareExportAllDeclaration>;
617 isDeclareExportDeclaration(props?: object | null): this is NodePath<t.DeclareExportDeclaration>;
618 isDeclareFunction(props?: object | null): this is NodePath<t.DeclareFunction>;
619 isDeclareInterface(props?: object | null): this is NodePath<t.DeclareInterface>;
620 isDeclareModule(props?: object | null): this is NodePath<t.DeclareModule>;
621 isDeclareModuleExports(props?: object | null): this is NodePath<t.DeclareModuleExports>;
622 isDeclareOpaqueType(props?: object | null): this is NodePath<t.DeclareOpaqueType>;
623 isDeclareTypeAlias(props?: object | null): this is NodePath<t.DeclareTypeAlias>;
624 isDeclareVariable(props?: object | null): this is NodePath<t.DeclareVariable>;
625 isDeclaredPredicate(props?: object | null): this is NodePath<t.DeclaredPredicate>;
626 isDecorator(props?: object | null): this is NodePath<t.Decorator>;
627 isDirective(props?: object | null): this is NodePath<t.Directive>;
628 isDirectiveLiteral(props?: object | null): this is NodePath<t.DirectiveLiteral>;
629 isDoExpression(props?: object | null): this is NodePath<t.DoExpression>;
630 isDoWhileStatement(props?: object | null): this is NodePath<t.DoWhileStatement>;
631 isEmptyStatement(props?: object | null): this is NodePath<t.EmptyStatement>;
632 isEmptyTypeAnnotation(props?: object | null): this is NodePath<t.EmptyTypeAnnotation>;
633 isExistsTypeAnnotation(props?: object | null): this is NodePath<t.ExistsTypeAnnotation>;
634 isExportAllDeclaration(props?: object | null): this is NodePath<t.ExportAllDeclaration>;
635 isExportDeclaration(props?: object | null): this is NodePath<t.ExportDeclaration>;
636 isExportDefaultDeclaration(props?: object | null): this is NodePath<t.ExportDefaultDeclaration>;
637 isExportDefaultSpecifier(props?: object | null): this is NodePath<t.ExportDefaultSpecifier>;
638 isExportNamedDeclaration(props?: object | null): this is NodePath<t.ExportNamedDeclaration>;
639 isExportNamespaceSpecifier(props?: object | null): this is NodePath<t.ExportNamespaceSpecifier>;
640 isExportSpecifier(props?: object | null): this is NodePath<t.ExportSpecifier>;
641 isExpression(props?: object | null): this is NodePath<t.Expression>;
642 isExpressionStatement(props?: object | null): this is NodePath<t.ExpressionStatement>;
643 isExpressionWrapper(props?: object | null): this is NodePath<t.ExpressionWrapper>;
644 isFile(props?: object | null): this is NodePath<t.File>;
645 isFlow(props?: object | null): this is NodePath<t.Flow>;
646 isFlowBaseAnnotation(props?: object | null): this is NodePath<t.FlowBaseAnnotation>;
647 isFlowDeclaration(props?: object | null): this is NodePath<t.FlowDeclaration>;
648 isFlowPredicate(props?: object | null): this is NodePath<t.FlowPredicate>;
649 isFlowType(props?: object | null): this is NodePath<t.FlowType>;
650 isFor(props?: object | null): this is NodePath<t.For>;
651 isForInStatement(props?: object | null): this is NodePath<t.ForInStatement>;
652 isForOfStatement(props?: object | null): this is NodePath<t.ForOfStatement>;
653 isForStatement(props?: object | null): this is NodePath<t.ForStatement>;
654 isForXStatement(props?: object | null): this is NodePath<t.ForXStatement>;
655 isFunction(props?: object | null): this is NodePath<t.Function>;
656 isFunctionDeclaration(props?: object | null): this is NodePath<t.FunctionDeclaration>;
657 isFunctionExpression(props?: object | null): this is NodePath<t.FunctionExpression>;
658 isFunctionParent(props?: object | null): this is NodePath<t.FunctionParent>;
659 isFunctionTypeAnnotation(props?: object | null): this is NodePath<t.FunctionTypeAnnotation>;
660 isFunctionTypeParam(props?: object | null): this is NodePath<t.FunctionTypeParam>;
661 isGenericTypeAnnotation(props?: object | null): this is NodePath<t.GenericTypeAnnotation>;
662 isIdentifier(props?: object | null): this is NodePath<t.Identifier>;
663 isIfStatement(props?: object | null): this is NodePath<t.IfStatement>;
664 isImmutable(props?: object | null): this is NodePath<t.Immutable>;
665 isImport(props?: object | null): this is NodePath<t.Import>;
666 isImportDeclaration(props?: object | null): this is NodePath<t.ImportDeclaration>;
667 isImportDefaultSpecifier(props?: object | null): this is NodePath<t.ImportDefaultSpecifier>;
668 isImportNamespaceSpecifier(props?: object | null): this is NodePath<t.ImportNamespaceSpecifier>;
669 isImportSpecifier(props?: object | null): this is NodePath<t.ImportSpecifier>;
670 isInferredPredicate(props?: object | null): this is NodePath<t.InferredPredicate>;
671 isInterfaceDeclaration(props?: object | null): this is NodePath<t.InterfaceDeclaration>;
672 isInterfaceExtends(props?: object | null): this is NodePath<t.InterfaceExtends>;
673 isInterfaceTypeAnnotation(props?: object | null): this is NodePath<t.InterfaceTypeAnnotation>;
674 isInterpreterDirective(props?: object | null): this is NodePath<t.InterpreterDirective>;
675 isIntersectionTypeAnnotation(props?: object | null): this is NodePath<t.IntersectionTypeAnnotation>;
676 isJSX(props?: object | null): this is NodePath<t.JSX>;
677 isJSXAttribute(props?: object | null): this is NodePath<t.JSXAttribute>;
678 isJSXClosingElement(props?: object | null): this is NodePath<t.JSXClosingElement>;
679 isJSXClosingFragment(props?: object | null): this is NodePath<t.JSXClosingFragment>;
680 isJSXElement(props?: object | null): this is NodePath<t.JSXElement>;
681 isJSXEmptyExpression(props?: object | null): this is NodePath<t.JSXEmptyExpression>;
682 isJSXExpressionContainer(props?: object | null): this is NodePath<t.JSXExpressionContainer>;
683 isJSXFragment(props?: object | null): this is NodePath<t.JSXFragment>;
684 isJSXIdentifier(props?: object | null): this is NodePath<t.JSXIdentifier>;
685 isJSXMemberExpression(props?: object | null): this is NodePath<t.JSXMemberExpression>;
686 isJSXNamespacedName(props?: object | null): this is NodePath<t.JSXNamespacedName>;
687 isJSXOpeningElement(props?: object | null): this is NodePath<t.JSXOpeningElement>;
688 isJSXOpeningFragment(props?: object | null): this is NodePath<t.JSXOpeningFragment>;
689 isJSXSpreadAttribute(props?: object | null): this is NodePath<t.JSXSpreadAttribute>;
690 isJSXSpreadChild(props?: object | null): this is NodePath<t.JSXSpreadChild>;
691 isJSXText(props?: object | null): this is NodePath<t.JSXText>;
692 isLVal(props?: object | null): this is NodePath<t.LVal>;
693 isLabeledStatement(props?: object | null): this is NodePath<t.LabeledStatement>;
694 isLiteral(props?: object | null): this is NodePath<t.Literal>;
695 isLogicalExpression(props?: object | null): this is NodePath<t.LogicalExpression>;
696 isLoop(props?: object | null): this is NodePath<t.Loop>;
697 isMemberExpression(props?: object | null): this is NodePath<t.MemberExpression>;
698 isMetaProperty(props?: object | null): this is NodePath<t.MetaProperty>;
699 isMethod(props?: object | null): this is NodePath<t.Method>;
700 isMixedTypeAnnotation(props?: object | null): this is NodePath<t.MixedTypeAnnotation>;
701 isModuleDeclaration(props?: object | null): this is NodePath<t.ModuleDeclaration>;
702 isModuleSpecifier(props?: object | null): this is NodePath<t.ModuleSpecifier>;
703 isNewExpression(props?: object | null): this is NodePath<t.NewExpression>;
704 isNoop(props?: object | null): this is NodePath<t.Noop>;
705 isNullLiteral(props?: object | null): this is NodePath<t.NullLiteral>;
706 isNullLiteralTypeAnnotation(props?: object | null): this is NodePath<t.NullLiteralTypeAnnotation>;
707 isNullableTypeAnnotation(props?: object | null): this is NodePath<t.NullableTypeAnnotation>;
708
709 /** @deprecated Use `isNumericLiteral` */
710 isNumberLiteral(props?: object | null): this is NodePath<t.NumericLiteral>;
711 isNumberLiteralTypeAnnotation(props?: object | null): this is NodePath<t.NumberLiteralTypeAnnotation>;
712 isNumberTypeAnnotation(props?: object | null): this is NodePath<t.NumberTypeAnnotation>;
713 isNumericLiteral(props?: object | null): this is NodePath<t.NumericLiteral>;
714 isObjectExpression(props?: object | null): this is NodePath<t.ObjectExpression>;
715 isObjectMember(props?: object | null): this is NodePath<t.ObjectMember>;
716 isObjectMethod(props?: object | null): this is NodePath<t.ObjectMethod>;
717 isObjectPattern(props?: object | null): this is NodePath<t.ObjectPattern>;
718 isObjectProperty(props?: object | null): this is NodePath<t.ObjectProperty>;
719 isObjectTypeAnnotation(props?: object | null): this is NodePath<t.ObjectTypeAnnotation>;
720 isObjectTypeCallProperty(props?: object | null): this is NodePath<t.ObjectTypeCallProperty>;
721 isObjectTypeIndexer(props?: object | null): this is NodePath<t.ObjectTypeIndexer>;
722 isObjectTypeInternalSlot(props?: object | null): this is NodePath<t.ObjectTypeInternalSlot>;
723 isObjectTypeProperty(props?: object | null): this is NodePath<t.ObjectTypeProperty>;
724 isObjectTypeSpreadProperty(props?: object | null): this is NodePath<t.ObjectTypeSpreadProperty>;
725 isOpaqueType(props?: object | null): this is NodePath<t.OpaqueType>;
726 isOptionalCallExpression(props?: object | null): this is NodePath<t.OptionalCallExpression>;
727 isOptionalMemberExpression(props?: object | null): this is NodePath<t.OptionalMemberExpression>;
728 isParenthesizedExpression(props?: object | null): this is NodePath<t.ParenthesizedExpression>;
729 isPattern(props?: object | null): this is NodePath<t.Pattern>;
730 isPatternLike(props?: object | null): this is NodePath<t.PatternLike>;
731 isPipelineBareFunction(props?: object | null): this is NodePath<t.PipelineBareFunction>;
732 isPipelinePrimaryTopicReference(props?: object | null): this is NodePath<t.PipelinePrimaryTopicReference>;
733 isPipelineTopicExpression(props?: object | null): this is NodePath<t.PipelineTopicExpression>;
734 isPrivate(props?: object | null): this is NodePath<t.Private>;
735 isPrivateName(props?: object | null): this is NodePath<t.PrivateName>;
736 isProgram(props?: object | null): this is NodePath<t.Program>;
737 isProperty(props?: object | null): this is NodePath<t.Property>;
738 isPureish(props?: object | null): this is NodePath<t.Pureish>;
739 isQualifiedTypeIdentifier(props?: object | null): this is NodePath<t.QualifiedTypeIdentifier>;
740 isRegExpLiteral(props?: object | null): this is NodePath<t.RegExpLiteral>;
741
742 /** @deprecated Use `isRegExpLiteral` */
743 isRegexLiteral(props?: object | null): this is NodePath<t.RegExpLiteral>;
744 isRestElement(props?: object | null): this is NodePath<t.RestElement>;
745
746 /** @deprecated Use `isRestElement` */
747 isRestProperty(props?: object | null): this is NodePath<t.RestElement>;
748 isReturnStatement(props?: object | null): this is NodePath<t.ReturnStatement>;
749 isScopable(props?: object | null): this is NodePath<t.Scopable>;
750 isSequenceExpression(props?: object | null): this is NodePath<t.SequenceExpression>;
751 isSpreadElement(props?: object | null): this is NodePath<t.SpreadElement>;
752
753 /** @deprecated Use `isSpreadElement` */
754 isSpreadProperty(props?: object | null): this is NodePath<t.SpreadElement>;
755 isStatement(props?: object | null): this is NodePath<t.Statement>;
756 isStringLiteral(props?: object | null): this is NodePath<t.StringLiteral>;
757 isStringLiteralTypeAnnotation(props?: object | null): this is NodePath<t.StringLiteralTypeAnnotation>;
758 isStringTypeAnnotation(props?: object | null): this is NodePath<t.StringTypeAnnotation>;
759 isSuper(props?: object | null): this is NodePath<t.Super>;
760 isSwitchCase(props?: object | null): this is NodePath<t.SwitchCase>;
761 isSwitchStatement(props?: object | null): this is NodePath<t.SwitchStatement>;
762 isTSAnyKeyword(props?: object | null): this is NodePath<t.TSAnyKeyword>;
763 isTSArrayType(props?: object | null): this is NodePath<t.TSArrayType>;
764 isTSAsExpression(props?: object | null): this is NodePath<t.TSAsExpression>;
765 isTSBooleanKeyword(props?: object | null): this is NodePath<t.TSBooleanKeyword>;
766 isTSCallSignatureDeclaration(props?: object | null): this is NodePath<t.TSCallSignatureDeclaration>;
767 isTSConditionalType(props?: object | null): this is NodePath<t.TSConditionalType>;
768 isTSConstructSignatureDeclaration(props?: object | null): this is NodePath<t.TSConstructSignatureDeclaration>;
769 isTSConstructorType(props?: object | null): this is NodePath<t.TSConstructorType>;
770 isTSDeclareFunction(props?: object | null): this is NodePath<t.TSDeclareFunction>;
771 isTSDeclareMethod(props?: object | null): this is NodePath<t.TSDeclareMethod>;
772 isTSEntityName(props?: object | null): this is NodePath<t.TSEntityName>;
773 isTSEnumDeclaration(props?: object | null): this is NodePath<t.TSEnumDeclaration>;
774 isTSEnumMember(props?: object | null): this is NodePath<t.TSEnumMember>;
775 isTSExportAssignment(props?: object | null): this is NodePath<t.TSExportAssignment>;
776 isTSExpressionWithTypeArguments(props?: object | null): this is NodePath<t.TSExpressionWithTypeArguments>;
777 isTSExternalModuleReference(props?: object | null): this is NodePath<t.TSExternalModuleReference>;
778 isTSFunctionType(props?: object | null): this is NodePath<t.TSFunctionType>;
779 isTSImportEqualsDeclaration(props?: object | null): this is NodePath<t.TSImportEqualsDeclaration>;
780 isTSImportType(props?: object | null): this is NodePath<t.TSImportType>;
781 isTSIndexSignature(props?: object | null): this is NodePath<t.TSIndexSignature>;
782 isTSIndexedAccessType(props?: object | null): this is NodePath<t.TSIndexedAccessType>;
783 isTSInferType(props?: object | null): this is NodePath<t.TSInferType>;
784 isTSInterfaceBody(props?: object | null): this is NodePath<t.TSInterfaceBody>;
785 isTSInterfaceDeclaration(props?: object | null): this is NodePath<t.TSInterfaceDeclaration>;
786 isTSIntersectionType(props?: object | null): this is NodePath<t.TSIntersectionType>;
787 isTSLiteralType(props?: object | null): this is NodePath<t.TSLiteralType>;
788 isTSMappedType(props?: object | null): this is NodePath<t.TSMappedType>;
789 isTSMethodSignature(props?: object | null): this is NodePath<t.TSMethodSignature>;
790 isTSModuleBlock(props?: object | null): this is NodePath<t.TSModuleBlock>;
791 isTSModuleDeclaration(props?: object | null): this is NodePath<t.TSModuleDeclaration>;
792 isTSNamespaceExportDeclaration(props?: object | null): this is NodePath<t.TSNamespaceExportDeclaration>;
793 isTSNeverKeyword(props?: object | null): this is NodePath<t.TSNeverKeyword>;
794 isTSNonNullExpression(props?: object | null): this is NodePath<t.TSNonNullExpression>;
795 isTSNullKeyword(props?: object | null): this is NodePath<t.TSNullKeyword>;
796 isTSNumberKeyword(props?: object | null): this is NodePath<t.TSNumberKeyword>;
797 isTSObjectKeyword(props?: object | null): this is NodePath<t.TSObjectKeyword>;
798 isTSOptionalType(props?: object | null): this is NodePath<t.TSOptionalType>;
799 isTSParameterProperty(props?: object | null): this is NodePath<t.TSParameterProperty>;
800 isTSParenthesizedType(props?: object | null): this is NodePath<t.TSParenthesizedType>;
801 isTSPropertySignature(props?: object | null): this is NodePath<t.TSPropertySignature>;
802 isTSQualifiedName(props?: object | null): this is NodePath<t.TSQualifiedName>;
803 isTSRestType(props?: object | null): this is NodePath<t.TSRestType>;
804 isTSStringKeyword(props?: object | null): this is NodePath<t.TSStringKeyword>;
805 isTSSymbolKeyword(props?: object | null): this is NodePath<t.TSSymbolKeyword>;
806 isTSThisType(props?: object | null): this is NodePath<t.TSThisType>;
807 isTSTupleType(props?: object | null): this is NodePath<t.TSTupleType>;
808 isTSType(props?: object | null): this is NodePath<t.TSType>;
809 isTSTypeAliasDeclaration(props?: object | null): this is NodePath<t.TSTypeAliasDeclaration>;
810 isTSTypeAnnotation(props?: object | null): this is NodePath<t.TSTypeAnnotation>;
811 isTSTypeAssertion(props?: object | null): this is NodePath<t.TSTypeAssertion>;
812 isTSTypeElement(props?: object | null): this is NodePath<t.TSTypeElement>;
813 isTSTypeLiteral(props?: object | null): this is NodePath<t.TSTypeLiteral>;
814 isTSTypeOperator(props?: object | null): this is NodePath<t.TSTypeOperator>;
815 isTSTypeParameter(props?: object | null): this is NodePath<t.TSTypeParameter>;
816 isTSTypeParameterDeclaration(props?: object | null): this is NodePath<t.TSTypeParameterDeclaration>;
817 isTSTypeParameterInstantiation(props?: object | null): this is NodePath<t.TSTypeParameterInstantiation>;
818 isTSTypePredicate(props?: object | null): this is NodePath<t.TSTypePredicate>;
819 isTSTypeQuery(props?: object | null): this is NodePath<t.TSTypeQuery>;
820 isTSTypeReference(props?: object | null): this is NodePath<t.TSTypeReference>;
821 isTSUndefinedKeyword(props?: object | null): this is NodePath<t.TSUndefinedKeyword>;
822 isTSUnionType(props?: object | null): this is NodePath<t.TSUnionType>;
823 isTSUnknownKeyword(props?: object | null): this is NodePath<t.TSUnknownKeyword>;
824 isTSVoidKeyword(props?: object | null): this is NodePath<t.TSVoidKeyword>;
825 isTaggedTemplateExpression(props?: object | null): this is NodePath<t.TaggedTemplateExpression>;
826 isTemplateElement(props?: object | null): this is NodePath<t.TemplateElement>;
827 isTemplateLiteral(props?: object | null): this is NodePath<t.TemplateLiteral>;
828 isTerminatorless(props?: object | null): this is NodePath<t.Terminatorless>;
829 isThisExpression(props?: object | null): this is NodePath<t.ThisExpression>;
830 isThisTypeAnnotation(props?: object | null): this is NodePath<t.ThisTypeAnnotation>;
831 isThrowStatement(props?: object | null): this is NodePath<t.ThrowStatement>;
832 isTryStatement(props?: object | null): this is NodePath<t.TryStatement>;
833 isTupleTypeAnnotation(props?: object | null): this is NodePath<t.TupleTypeAnnotation>;
834 isTypeAlias(props?: object | null): this is NodePath<t.TypeAlias>;
835 isTypeAnnotation(props?: object | null): this is NodePath<t.TypeAnnotation>;
836 isTypeCastExpression(props?: object | null): this is NodePath<t.TypeCastExpression>;
837 isTypeParameter(props?: object | null): this is NodePath<t.TypeParameter>;
838 isTypeParameterDeclaration(props?: object | null): this is NodePath<t.TypeParameterDeclaration>;
839 isTypeParameterInstantiation(props?: object | null): this is NodePath<t.TypeParameterInstantiation>;
840 isTypeofTypeAnnotation(props?: object | null): this is NodePath<t.TypeofTypeAnnotation>;
841 isUnaryExpression(props?: object | null): this is NodePath<t.UnaryExpression>;
842 isUnaryLike(props?: object | null): this is NodePath<t.UnaryLike>;
843 isUnionTypeAnnotation(props?: object | null): this is NodePath<t.UnionTypeAnnotation>;
844 isUpdateExpression(props?: object | null): this is NodePath<t.UpdateExpression>;
845 isUserWhitespacable(props?: object | null): this is NodePath<t.UserWhitespacable>;
846 isVariableDeclaration(props?: object | null): this is NodePath<t.VariableDeclaration>;
847 isVariableDeclarator(props?: object | null): this is NodePath<t.VariableDeclarator>;
848 isVariance(props?: object | null): this is NodePath<t.Variance>;
849 isVoidTypeAnnotation(props?: object | null): this is NodePath<t.VoidTypeAnnotation>;
850 isWhile(props?: object | null): this is NodePath<t.While>;
851 isWhileStatement(props?: object | null): this is NodePath<t.WhileStatement>;
852 isWithStatement(props?: object | null): this is NodePath<t.WithStatement>;
853 isYieldExpression(props?: object | null): this is NodePath<t.YieldExpression>;
854
855 isBindingIdentifier(props?: object | null): this is NodePath<t.Identifier>;
856 isBlockScoped(
857 props?: object | null,
858 ): this is NodePath<t.FunctionDeclaration | t.ClassDeclaration | t.VariableDeclaration>;
859 isGenerated(props?: object | null): boolean;
860 isPure(props?: object | null): boolean;
861 isReferenced(props?: object | null): boolean;
862 isReferencedIdentifier(props?: object | null): this is NodePath<t.Identifier | t.JSXIdentifier>;
863 isReferencedMemberExpression(props?: object | null): this is NodePath<t.MemberExpression>;
864 isScope(props?: object | null): this is NodePath<t.Scopable>;
865 isUser(props?: object | null): boolean;
866 isVar(props?: object | null): this is NodePath<t.VariableDeclaration>;
867 //#endregion
868
869 //#region ------------------------- assertXXX -------------------------
870 assertAnyTypeAnnotation(props?: object | null): void;
871 assertArrayExpression(props?: object | null): void;
872 assertArrayPattern(props?: object | null): void;
873 assertArrayTypeAnnotation(props?: object | null): void;
874 assertArrowFunctionExpression(props?: object | null): void;
875 assertAssignmentExpression(props?: object | null): void;
876 assertAssignmentPattern(props?: object | null): void;
877 assertAwaitExpression(props?: object | null): void;
878 assertBigIntLiteral(props?: object | null): void;
879 assertBinary(props?: object | null): void;
880 assertBinaryExpression(props?: object | null): void;
881 assertBindExpression(props?: object | null): void;
882 assertBlock(props?: object | null): void;
883 assertBlockParent(props?: object | null): void;
884 assertBlockStatement(props?: object | null): void;
885 assertBooleanLiteral(props?: object | null): void;
886 assertBooleanLiteralTypeAnnotation(props?: object | null): void;
887 assertBooleanTypeAnnotation(props?: object | null): void;
888 assertBreakStatement(props?: object | null): void;
889 assertCallExpression(props?: object | null): void;
890 assertCatchClause(props?: object | null): void;
891 assertClass(props?: object | null): void;
892 assertClassBody(props?: object | null): void;
893 assertClassDeclaration(props?: object | null): void;
894 assertClassExpression(props?: object | null): void;
895 assertClassImplements(props?: object | null): void;
896 assertClassMethod(props?: object | null): void;
897 assertClassPrivateMethod(props?: object | null): void;
898 assertClassPrivateProperty(props?: object | null): void;
899 assertClassProperty(props?: object | null): void;
900 assertCompletionStatement(props?: object | null): void;
901 assertConditional(props?: object | null): void;
902 assertConditionalExpression(props?: object | null): void;
903 assertContinueStatement(props?: object | null): void;
904 assertDebuggerStatement(props?: object | null): void;
905 assertDeclaration(props?: object | null): void;
906 assertDeclareClass(props?: object | null): void;
907 assertDeclareExportAllDeclaration(props?: object | null): void;
908 assertDeclareExportDeclaration(props?: object | null): void;
909 assertDeclareFunction(props?: object | null): void;
910 assertDeclareInterface(props?: object | null): void;
911 assertDeclareModule(props?: object | null): void;
912 assertDeclareModuleExports(props?: object | null): void;
913 assertDeclareOpaqueType(props?: object | null): void;
914 assertDeclareTypeAlias(props?: object | null): void;
915 assertDeclareVariable(props?: object | null): void;
916 assertDeclaredPredicate(props?: object | null): void;
917 assertDecorator(props?: object | null): void;
918 assertDirective(props?: object | null): void;
919 assertDirectiveLiteral(props?: object | null): void;
920 assertDoExpression(props?: object | null): void;
921 assertDoWhileStatement(props?: object | null): void;
922 assertEmptyStatement(props?: object | null): void;
923 assertEmptyTypeAnnotation(props?: object | null): void;
924 assertExistsTypeAnnotation(props?: object | null): void;
925 assertExportAllDeclaration(props?: object | null): void;
926 assertExportDeclaration(props?: object | null): void;
927 assertExportDefaultDeclaration(props?: object | null): void;
928 assertExportDefaultSpecifier(props?: object | null): void;
929 assertExportNamedDeclaration(props?: object | null): void;
930 assertExportNamespaceSpecifier(props?: object | null): void;
931 assertExportSpecifier(props?: object | null): void;
932 assertExpression(props?: object | null): void;
933 assertExpressionStatement(props?: object | null): void;
934 assertExpressionWrapper(props?: object | null): void;
935 assertFile(props?: object | null): void;
936 assertFlow(props?: object | null): void;
937 assertFlowBaseAnnotation(props?: object | null): void;
938 assertFlowDeclaration(props?: object | null): void;
939 assertFlowPredicate(props?: object | null): void;
940 assertFlowType(props?: object | null): void;
941 assertFor(props?: object | null): void;
942 assertForInStatement(props?: object | null): void;
943 assertForOfStatement(props?: object | null): void;
944 assertForStatement(props?: object | null): void;
945 assertForXStatement(props?: object | null): void;
946 assertFunction(props?: object | null): void;
947 assertFunctionDeclaration(props?: object | null): void;
948 assertFunctionExpression(props?: object | null): void;
949 assertFunctionParent(props?: object | null): void;
950 assertFunctionTypeAnnotation(props?: object | null): void;
951 assertFunctionTypeParam(props?: object | null): void;
952 assertGenericTypeAnnotation(props?: object | null): void;
953 assertIdentifier(props?: object | null): void;
954 assertIfStatement(props?: object | null): void;
955 assertImmutable(props?: object | null): void;
956 assertImport(props?: object | null): void;
957 assertImportDeclaration(props?: object | null): void;
958 assertImportDefaultSpecifier(props?: object | null): void;
959 assertImportNamespaceSpecifier(props?: object | null): void;
960 assertImportSpecifier(props?: object | null): void;
961 assertInferredPredicate(props?: object | null): void;
962 assertInterfaceDeclaration(props?: object | null): void;
963 assertInterfaceExtends(props?: object | null): void;
964 assertInterfaceTypeAnnotation(props?: object | null): void;
965 assertInterpreterDirective(props?: object | null): void;
966 assertIntersectionTypeAnnotation(props?: object | null): void;
967 assertJSX(props?: object | null): void;
968 assertJSXAttribute(props?: object | null): void;
969 assertJSXClosingElement(props?: object | null): void;
970 assertJSXClosingFragment(props?: object | null): void;
971 assertJSXElement(props?: object | null): void;
972 assertJSXEmptyExpression(props?: object | null): void;
973 assertJSXExpressionContainer(props?: object | null): void;
974 assertJSXFragment(props?: object | null): void;
975 assertJSXIdentifier(props?: object | null): void;
976 assertJSXMemberExpression(props?: object | null): void;
977 assertJSXNamespacedName(props?: object | null): void;
978 assertJSXOpeningElement(props?: object | null): void;
979 assertJSXOpeningFragment(props?: object | null): void;
980 assertJSXSpreadAttribute(props?: object | null): void;
981 assertJSXSpreadChild(props?: object | null): void;
982 assertJSXText(props?: object | null): void;
983 assertLVal(props?: object | null): void;
984 assertLabeledStatement(props?: object | null): void;
985 assertLiteral(props?: object | null): void;
986 assertLogicalExpression(props?: object | null): void;
987 assertLoop(props?: object | null): void;
988 assertMemberExpression(props?: object | null): void;
989 assertMetaProperty(props?: object | null): void;
990 assertMethod(props?: object | null): void;
991 assertMixedTypeAnnotation(props?: object | null): void;
992 assertModuleDeclaration(props?: object | null): void;
993 assertModuleSpecifier(props?: object | null): void;
994 assertNewExpression(props?: object | null): void;
995 assertNoop(props?: object | null): void;
996 assertNullLiteral(props?: object | null): void;
997 assertNullLiteralTypeAnnotation(props?: object | null): void;
998 assertNullableTypeAnnotation(props?: object | null): void;
999
1000 /** @deprecated Use `assertNumericLiteral` */
1001 assertNumberLiteral(props?: object | null): void;
1002 assertNumberLiteralTypeAnnotation(props?: object | null): void;
1003 assertNumberTypeAnnotation(props?: object | null): void;
1004 assertNumericLiteral(props?: object | null): void;
1005 assertObjectExpression(props?: object | null): void;
1006 assertObjectMember(props?: object | null): void;
1007 assertObjectMethod(props?: object | null): void;
1008 assertObjectPattern(props?: object | null): void;
1009 assertObjectProperty(props?: object | null): void;
1010 assertObjectTypeAnnotation(props?: object | null): void;
1011 assertObjectTypeCallProperty(props?: object | null): void;
1012 assertObjectTypeIndexer(props?: object | null): void;
1013 assertObjectTypeInternalSlot(props?: object | null): void;
1014 assertObjectTypeProperty(props?: object | null): void;
1015 assertObjectTypeSpreadProperty(props?: object | null): void;
1016 assertOpaqueType(props?: object | null): void;
1017 assertOptionalCallExpression(props?: object | null): void;
1018 assertOptionalMemberExpression(props?: object | null): void;
1019 assertParenthesizedExpression(props?: object | null): void;
1020 assertPattern(props?: object | null): void;
1021 assertPatternLike(props?: object | null): void;
1022 assertPipelineBareFunction(props?: object | null): void;
1023 assertPipelinePrimaryTopicReference(props?: object | null): void;
1024 assertPipelineTopicExpression(props?: object | null): void;
1025 assertPrivate(props?: object | null): void;
1026 assertPrivateName(props?: object | null): void;
1027 assertProgram(props?: object | null): void;
1028 assertProperty(props?: object | null): void;
1029 assertPureish(props?: object | null): void;
1030 assertQualifiedTypeIdentifier(props?: object | null): void;
1031 assertRegExpLiteral(props?: object | null): void;
1032
1033 /** @deprecated Use `assertRegExpLiteral` */
1034 assertRegexLiteral(props?: object | null): void;
1035 assertRestElement(props?: object | null): void;
1036
1037 /** @deprecated Use `assertRestElement` */
1038 assertRestProperty(props?: object | null): void;
1039 assertReturnStatement(props?: object | null): void;
1040 assertScopable(props?: object | null): void;
1041 assertSequenceExpression(props?: object | null): void;
1042 assertSpreadElement(props?: object | null): void;
1043
1044 /** @deprecated Use `assertSpreadElement` */
1045 assertSpreadProperty(props?: object | null): void;
1046 assertStatement(props?: object | null): void;
1047 assertStringLiteral(props?: object | null): void;
1048 assertStringLiteralTypeAnnotation(props?: object | null): void;
1049 assertStringTypeAnnotation(props?: object | null): void;
1050 assertSuper(props?: object | null): void;
1051 assertSwitchCase(props?: object | null): void;
1052 assertSwitchStatement(props?: object | null): void;
1053 assertTSAnyKeyword(props?: object | null): void;
1054 assertTSArrayType(props?: object | null): void;
1055 assertTSAsExpression(props?: object | null): void;
1056 assertTSBooleanKeyword(props?: object | null): void;
1057 assertTSCallSignatureDeclaration(props?: object | null): void;
1058 assertTSConditionalType(props?: object | null): void;
1059 assertTSConstructSignatureDeclaration(props?: object | null): void;
1060 assertTSConstructorType(props?: object | null): void;
1061 assertTSDeclareFunction(props?: object | null): void;
1062 assertTSDeclareMethod(props?: object | null): void;
1063 assertTSEntityName(props?: object | null): void;
1064 assertTSEnumDeclaration(props?: object | null): void;
1065 assertTSEnumMember(props?: object | null): void;
1066 assertTSExportAssignment(props?: object | null): void;
1067 assertTSExpressionWithTypeArguments(props?: object | null): void;
1068 assertTSExternalModuleReference(props?: object | null): void;
1069 assertTSFunctionType(props?: object | null): void;
1070 assertTSImportEqualsDeclaration(props?: object | null): void;
1071 assertTSImportType(props?: object | null): void;
1072 assertTSIndexSignature(props?: object | null): void;
1073 assertTSIndexedAccessType(props?: object | null): void;
1074 assertTSInferType(props?: object | null): void;
1075 assertTSInterfaceBody(props?: object | null): void;
1076 assertTSInterfaceDeclaration(props?: object | null): void;
1077 assertTSIntersectionType(props?: object | null): void;
1078 assertTSLiteralType(props?: object | null): void;
1079 assertTSMappedType(props?: object | null): void;
1080 assertTSMethodSignature(props?: object | null): void;
1081 assertTSModuleBlock(props?: object | null): void;
1082 assertTSModuleDeclaration(props?: object | null): void;
1083 assertTSNamespaceExportDeclaration(props?: object | null): void;
1084 assertTSNeverKeyword(props?: object | null): void;
1085 assertTSNonNullExpression(props?: object | null): void;
1086 assertTSNullKeyword(props?: object | null): void;
1087 assertTSNumberKeyword(props?: object | null): void;
1088 assertTSObjectKeyword(props?: object | null): void;
1089 assertTSOptionalType(props?: object | null): void;
1090 assertTSParameterProperty(props?: object | null): void;
1091 assertTSParenthesizedType(props?: object | null): void;
1092 assertTSPropertySignature(props?: object | null): void;
1093 assertTSQualifiedName(props?: object | null): void;
1094 assertTSRestType(props?: object | null): void;
1095 assertTSStringKeyword(props?: object | null): void;
1096 assertTSSymbolKeyword(props?: object | null): void;
1097 assertTSThisType(props?: object | null): void;
1098 assertTSTupleType(props?: object | null): void;
1099 assertTSType(props?: object | null): void;
1100 assertTSTypeAliasDeclaration(props?: object | null): void;
1101 assertTSTypeAnnotation(props?: object | null): void;
1102 assertTSTypeAssertion(props?: object | null): void;
1103 assertTSTypeElement(props?: object | null): void;
1104 assertTSTypeLiteral(props?: object | null): void;
1105 assertTSTypeOperator(props?: object | null): void;
1106 assertTSTypeParameter(props?: object | null): void;
1107 assertTSTypeParameterDeclaration(props?: object | null): void;
1108 assertTSTypeParameterInstantiation(props?: object | null): void;
1109 assertTSTypePredicate(props?: object | null): void;
1110 assertTSTypeQuery(props?: object | null): void;
1111 assertTSTypeReference(props?: object | null): void;
1112 assertTSUndefinedKeyword(props?: object | null): void;
1113 assertTSUnionType(props?: object | null): void;
1114 assertTSUnknownKeyword(props?: object | null): void;
1115 assertTSVoidKeyword(props?: object | null): void;
1116 assertTaggedTemplateExpression(props?: object | null): void;
1117 assertTemplateElement(props?: object | null): void;
1118 assertTemplateLiteral(props?: object | null): void;
1119 assertTerminatorless(props?: object | null): void;
1120 assertThisExpression(props?: object | null): void;
1121 assertThisTypeAnnotation(props?: object | null): void;
1122 assertThrowStatement(props?: object | null): void;
1123 assertTryStatement(props?: object | null): void;
1124 assertTupleTypeAnnotation(props?: object | null): void;
1125 assertTypeAlias(props?: object | null): void;
1126 assertTypeAnnotation(props?: object | null): void;
1127 assertTypeCastExpression(props?: object | null): void;
1128 assertTypeParameter(props?: object | null): void;
1129 assertTypeParameterDeclaration(props?: object | null): void;
1130 assertTypeParameterInstantiation(props?: object | null): void;
1131 assertTypeofTypeAnnotation(props?: object | null): void;
1132 assertUnaryExpression(props?: object | null): void;
1133 assertUnaryLike(props?: object | null): void;
1134 assertUnionTypeAnnotation(props?: object | null): void;
1135 assertUpdateExpression(props?: object | null): void;
1136 assertUserWhitespacable(props?: object | null): void;
1137 assertVariableDeclaration(props?: object | null): void;
1138 assertVariableDeclarator(props?: object | null): void;
1139 assertVariance(props?: object | null): void;
1140 assertVoidTypeAnnotation(props?: object | null): void;
1141 assertWhile(props?: object | null): void;
1142 assertWhileStatement(props?: object | null): void;
1143 assertWithStatement(props?: object | null): void;
1144 assertYieldExpression(props?: object | null): void;
1145
1146 assertBindingIdentifier(props?: object | null): void;
1147 assertBlockScoped(props?: object | null): void;
1148 assertGenerated(props?: object | null): void;
1149 assertPure(props?: object | null): void;
1150 assertReferenced(props?: object | null): void;
1151 assertReferencedIdentifier(props?: object | null): void;
1152 assertReferencedMemberExpression(props?: object | null): void;
1153 assertScope(props?: object | null): void;
1154 assertUser(props?: object | null): void;
1155 assertVar(props?: object | null): void;
1156 //#endregion
1157}
1158
1159export interface HubInterface {
1160 getCode(): string | undefined;
1161 getScope(): Scope | undefined;
1162 addHelper(name: string): any;
1163 buildError<E extends Error>(node: Node, msg: string, Error: new (message?: string) => E): E;
1164}
1165
1166export class Hub implements HubInterface {
1167 constructor();
1168 getCode(): string | undefined;
1169 getScope(): Scope | undefined;
1170 addHelper(name: string): any;
1171 buildError<E extends Error>(node: Node, msg: string, Constructor: new (message?: string) => E): E;
1172}
1173
1174export interface TraversalContext {
1175 parentPath: NodePath;
1176 scope: Scope;
1177 state: any;
1178 opts: any;
1179}
1180
\No newline at end of file