UNPKG

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