UNPKG

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