import * as t from "babel-types"; export type Node = t.Node; export default function traverse( parent: Node | Node[], opts: TraverseOptions, scope: Scope, state: S, parentPath?: NodePath, ): void; export default function traverse( parent: Node | Node[], opts: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath, ): void; export interface TraverseOptions extends Visitor { scope?: Scope | undefined; noScope?: boolean | undefined; } export class Scope { constructor(path: NodePath, parentScope?: Scope); path: NodePath; block: Node; parentBlock: Node; parent: Scope; hub: Hub; bindings: { [name: string]: Binding }; /** Traverse node with current scope and path. */ traverse(node: Node | Node[], opts: TraverseOptions, state: S): void; traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void; /** Generate a unique identifier and add it to the current scope. */ generateDeclaredUidIdentifier(name?: string): t.Identifier; /** Generate a unique identifier. */ generateUidIdentifier(name?: string): t.Identifier; /** Generate a unique `_id1` binding. */ generateUid(name?: string): string; /** Generate a unique identifier based on a node. */ generateUidIdentifierBasedOnNode(parent: Node, defaultName?: string): t.Identifier; /** * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. * evaluating it wont result in potentially arbitrary code from being ran. The following are * whitelisted and determined not to cause side effects: * * - `this` expressions * - `super` expressions * - Bound identifiers */ isStatic(node: Node): boolean; /** Possibly generate a memoised identifier if it is not static and has consequences. */ maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier; checkBlockScopedCollisions(local: Node, kind: string, name: string, id: object): void; rename(oldName: string, newName?: string, block?: Node): void; dump(): void; toArray(node: Node, i?: number): Node; registerDeclaration(path: NodePath): void; buildUndefinedNode(): Node; registerConstantViolation(path: NodePath): void; registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void; addGlobal(node: Node): void; hasUid(name: string): boolean; hasGlobal(name: string): boolean; hasReference(name: string): boolean; isPure(node: Node, constantsOnly?: boolean): boolean; setData(key: string, val: any): any; getData(key: string): any; removeData(key: string): void; push(opts: any): void; getProgramParent(): Scope; getFunctionParent(): Scope; getBlockParent(): Scope; /** Walks the scope tree and gathers **all** bindings. */ getAllBindings(...kinds: string[]): object; bindingIdentifierEquals(name: string, node: Node): boolean; getBinding(name: string): Binding | undefined; getOwnBinding(name: string): Binding | undefined; getBindingIdentifier(name: string): t.Identifier; getOwnBindingIdentifier(name: string): t.Identifier; hasOwnBinding(name: string): boolean; hasBinding(name: string, noGlobals?: boolean): boolean; parentHasBinding(name: string, noGlobals?: boolean): boolean; /** Move a binding of `name` to another `scope`. */ moveBindingTo(name: string, scope: Scope): void; removeOwnBinding(name: string): void; removeBinding(name: string): void; } export class Binding { constructor( opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; kind: "var" | "let" | "const"; }, ); identifier: t.Identifier; scope: Scope; path: NodePath; kind: "var" | "let" | "const" | "module"; referenced: boolean; references: number; referencePaths: NodePath[]; constant: boolean; constantViolations: NodePath[]; } // The Visitor has to be generic because babel binds `this` for each property. // `this` is usually used in babel plugins to pass plugin state from // `pre` -> `visitor` -> `post`. An example of this can be seen in the official // babel handbook: // https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#-pre-and-post-in-plugins export interface Visitor extends VisitNodeObject { ArrayExpression?: VisitNode | undefined; AssignmentExpression?: VisitNode | undefined; LVal?: VisitNode | undefined; Expression?: VisitNode | undefined; BinaryExpression?: VisitNode | undefined; Directive?: VisitNode | undefined; DirectiveLiteral?: VisitNode | undefined; BlockStatement?: VisitNode | undefined; BreakStatement?: VisitNode | undefined; Identifier?: VisitNode | undefined; CallExpression?: VisitNode | undefined; CatchClause?: VisitNode | undefined; ConditionalExpression?: VisitNode | undefined; ContinueStatement?: VisitNode | undefined; DebuggerStatement?: VisitNode | undefined; DoWhileStatement?: VisitNode | undefined; Statement?: VisitNode | undefined; EmptyStatement?: VisitNode | undefined; ExpressionStatement?: VisitNode | undefined; File?: VisitNode | undefined; Program?: VisitNode | undefined; ForInStatement?: VisitNode | undefined; VariableDeclaration?: VisitNode | undefined; ForStatement?: VisitNode | undefined; FunctionDeclaration?: VisitNode | undefined; FunctionExpression?: VisitNode | undefined; IfStatement?: VisitNode | undefined; LabeledStatement?: VisitNode | undefined; StringLiteral?: VisitNode | undefined; NumericLiteral?: VisitNode | undefined; NullLiteral?: VisitNode | undefined; BooleanLiteral?: VisitNode | undefined; RegExpLiteral?: VisitNode | undefined; LogicalExpression?: VisitNode | undefined; MemberExpression?: VisitNode | undefined; NewExpression?: VisitNode | undefined; ObjectExpression?: VisitNode | undefined; ObjectMethod?: VisitNode | undefined; ObjectProperty?: VisitNode | undefined; RestElement?: VisitNode | undefined; ReturnStatement?: VisitNode | undefined; SequenceExpression?: VisitNode | undefined; SwitchCase?: VisitNode | undefined; SwitchStatement?: VisitNode | undefined; ThisExpression?: VisitNode | undefined; ThrowStatement?: VisitNode | undefined; TryStatement?: VisitNode | undefined; UnaryExpression?: VisitNode | undefined; UpdateExpression?: VisitNode | undefined; VariableDeclarator?: VisitNode | undefined; WhileStatement?: VisitNode | undefined; WithStatement?: VisitNode | undefined; AssignmentPattern?: VisitNode | undefined; ArrayPattern?: VisitNode | undefined; ArrowFunctionExpression?: VisitNode | undefined; ClassBody?: VisitNode | undefined; ClassDeclaration?: VisitNode | undefined; ClassExpression?: VisitNode | undefined; ExportAllDeclaration?: VisitNode | undefined; ExportDefaultDeclaration?: VisitNode | undefined; ExportNamedDeclaration?: VisitNode | undefined; Declaration?: VisitNode | undefined; ExportSpecifier?: VisitNode | undefined; ForOfStatement?: VisitNode | undefined; ImportDeclaration?: VisitNode | undefined; ImportDefaultSpecifier?: VisitNode | undefined; ImportNamespaceSpecifier?: VisitNode | undefined; ImportSpecifier?: VisitNode | undefined; MetaProperty?: VisitNode | undefined; ClassMethod?: VisitNode | undefined; ObjectPattern?: VisitNode | undefined; SpreadElement?: VisitNode | undefined; Super?: VisitNode | undefined; TaggedTemplateExpression?: VisitNode | undefined; TemplateLiteral?: VisitNode | undefined; TemplateElement?: VisitNode | undefined; YieldExpression?: VisitNode | undefined; AnyTypeAnnotation?: VisitNode | undefined; ArrayTypeAnnotation?: VisitNode | undefined; BooleanTypeAnnotation?: VisitNode | undefined; BooleanLiteralTypeAnnotation?: VisitNode | undefined; NullLiteralTypeAnnotation?: VisitNode | undefined; ClassImplements?: VisitNode | undefined; ClassProperty?: VisitNode | undefined; DeclareClass?: VisitNode | undefined; DeclareFunction?: VisitNode | undefined; DeclareInterface?: VisitNode | undefined; DeclareModule?: VisitNode | undefined; DeclareTypeAlias?: VisitNode | undefined; DeclareVariable?: VisitNode | undefined; ExistentialTypeParam?: VisitNode | undefined; FunctionTypeAnnotation?: VisitNode | undefined; FunctionTypeParam?: VisitNode | undefined; GenericTypeAnnotation?: VisitNode | undefined; InterfaceExtends?: VisitNode | undefined; InterfaceDeclaration?: VisitNode | undefined; IntersectionTypeAnnotation?: VisitNode | undefined; MixedTypeAnnotation?: VisitNode | undefined; NullableTypeAnnotation?: VisitNode | undefined; NumericLiteralTypeAnnotation?: VisitNode | undefined; NumberTypeAnnotation?: VisitNode | undefined; StringLiteralTypeAnnotation?: VisitNode | undefined; StringTypeAnnotation?: VisitNode | undefined; ThisTypeAnnotation?: VisitNode | undefined; TupleTypeAnnotation?: VisitNode | undefined; TypeofTypeAnnotation?: VisitNode | undefined; TypeAlias?: VisitNode | undefined; TypeAnnotation?: VisitNode | undefined; TypeCastExpression?: VisitNode | undefined; TypeParameterDeclaration?: VisitNode | undefined; TypeParameterInstantiation?: VisitNode | undefined; ObjectTypeAnnotation?: VisitNode | undefined; ObjectTypeCallProperty?: VisitNode | undefined; ObjectTypeIndexer?: VisitNode | undefined; ObjectTypeProperty?: VisitNode | undefined; QualifiedTypeIdentifier?: VisitNode | undefined; UnionTypeAnnotation?: VisitNode | undefined; VoidTypeAnnotation?: VisitNode | undefined; JSXAttribute?: VisitNode | undefined; JSXIdentifier?: VisitNode | undefined; JSXNamespacedName?: VisitNode | undefined; JSXElement?: VisitNode | undefined; JSXExpressionContainer?: VisitNode | undefined; JSXClosingElement?: VisitNode | undefined; JSXMemberExpression?: VisitNode | undefined; JSXOpeningElement?: VisitNode | undefined; JSXEmptyExpression?: VisitNode | undefined; JSXSpreadAttribute?: VisitNode | undefined; JSXText?: VisitNode | undefined; Noop?: VisitNode | undefined; ParenthesizedExpression?: VisitNode | undefined; AwaitExpression?: VisitNode | undefined; BindExpression?: VisitNode | undefined; Decorator?: VisitNode | undefined; DoExpression?: VisitNode | undefined; ExportDefaultSpecifier?: VisitNode | undefined; ExportNamespaceSpecifier?: VisitNode | undefined; RestProperty?: VisitNode | undefined; SpreadProperty?: VisitNode | undefined; Binary?: VisitNode | undefined; Scopable?: VisitNode | undefined; BlockParent?: VisitNode | undefined; Block?: VisitNode | undefined; Terminatorless?: VisitNode | undefined; CompletionStatement?: VisitNode | undefined; Conditional?: VisitNode | undefined; Loop?: VisitNode | undefined; While?: VisitNode | undefined; ExpressionWrapper?: VisitNode | undefined; For?: VisitNode | undefined; ForXStatement?: VisitNode | undefined; Function?: VisitNode | undefined; FunctionParent?: VisitNode | undefined; Pureish?: VisitNode | undefined; Literal?: VisitNode | undefined; Immutable?: VisitNode | undefined; UserWhitespacable?: VisitNode | undefined; Method?: VisitNode | undefined; ObjectMember?: VisitNode | undefined; Property?: VisitNode | undefined; UnaryLike?: VisitNode | undefined; Pattern?: VisitNode | undefined; Class?: VisitNode | undefined; ModuleDeclaration?: VisitNode | undefined; ExportDeclaration?: VisitNode | undefined; ModuleSpecifier?: VisitNode | undefined; Flow?: VisitNode | undefined; FlowBaseAnnotation?: VisitNode | undefined; FlowDeclaration?: VisitNode | undefined; JSX?: VisitNode | undefined; Scope?: VisitNode | undefined; } export type VisitNode = VisitNodeFunction | VisitNodeObject; export type VisitNodeFunction = (this: T, path: NodePath

, state: any) => void; export interface VisitNodeObject { enter?(path: NodePath, state: any): void; exit?(path: NodePath, state: any): void; } export class NodePath { constructor(hub: Hub, parent: Node); parent: Node; hub: Hub; contexts: TraversalContext[]; data: object; shouldSkip: boolean; shouldStop: boolean; removed: boolean; state: any; opts: object; skipKeys: object; parentPath: NodePath; context: TraversalContext; container: object | object[]; listKey: string; inList: boolean; parentKey: string; key: string | number; node: T; scope: Scope; type: T extends undefined | null ? string | null : string; typeAnnotation: object; getScope(scope: Scope): Scope; setData(key: string, val: any): any; getData(key: string, def?: any): any; buildCodeFrameError(msg: string, Error?: new(msg: string) => TError): TError; traverse(visitor: Visitor, state: T): void; traverse(visitor: Visitor): void; set(key: string, node: Node): void; getPathLocation(): string; // Example: https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83 debug(buildMessage: () => string): void; // ------------------------- ancestry ------------------------- /** * Call the provided `callback` with the `NodePath`s of all the parents. * When the `callback` returns a truthy value, we return that node path. */ findParent(callback: (path: NodePath) => boolean): NodePath; find(callback: (path: NodePath) => boolean): NodePath; /** Get the parent function of the current path. */ getFunctionParent(): NodePath; /** Walk up the tree until we hit a parent node path in a list. */ getStatementParent(): NodePath; /** * Get the deepest common ancestor and then from it, get the earliest relationship path * to that ancestor. * * Earliest is defined as being "before" all the other nodes in terms of list container * position and visiting key. */ getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath[]; /** Get the earliest path in the tree where the provided `paths` intersect. */ getDeepestCommonAncestorFrom( paths: NodePath[], filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath, ): NodePath; /** * Build an array of node paths containing the entire ancestry of the current node path. * * NOTE: The current node path is included in this. */ getAncestry(): NodePath[]; inType(...candidateTypes: string[]): boolean; // ------------------------- inference ------------------------- /** Infer the type of the current `NodePath`. */ getTypeAnnotation(): t.FlowTypeAnnotation; isBaseType(baseName: string, soft?: boolean): boolean; couldBeBaseType(name: string): boolean; baseTypeStrictlyMatches(right: NodePath): boolean; isGenericType(genericName: string): boolean; // ------------------------- replacement ------------------------- /** * Replace a node with an array of multiple. This method performs the following steps: * * - Inherit the comments of first provided node with that of the current node. * - Insert the provided nodes after the current node. * - Remove the current node. */ replaceWithMultiple(nodes: Node[]): void; /** * Parse a string as an expression and replace the current node with the result. * * NOTE: This is typically not a good idea to use. Building source strings when * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's * easier to use, your transforms will be extremely brittle. */ replaceWithSourceString(replacement: any): void; /** Replace the current node with another. */ replaceWith(replacement: Node | NodePath): void; /** * This method takes an array of statements nodes and then explodes it * into expressions. This method retains completion records which is * extremely important to retain original semantics. */ replaceExpressionWithStatements(nodes: Node[]): Node; replaceInline(nodes: Node | Node[]): void; // ------------------------- evaluation ------------------------- /** * Walk the input `node` and statically evaluate if it's truthy. * * Returning `true` when we're sure that the expression will evaluate to a * truthy value, `false` if we're sure that it will evaluate to a falsy * value and `undefined` if we aren't sure. Because of this please do not * rely on coercion when using this method and check with === if it's false. */ evaluateTruthy(): boolean; /** * Walk the input `node` and statically evaluate it. * * Returns an object in the form `{ confident, value }`. `confident` indicates * whether or not we had to drop out of evaluating the expression because of * hitting an unknown node that we couldn't confidently find the value of. * * Example: * * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 } * t.evaluate(parse("!true")) // { confident: true, value: false } * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined } */ evaluate(): { confident: boolean; value: any }; // ------------------------- introspection ------------------------- /** * Match the current node if it matches the provided `pattern`. * * For example, given the match `React.createClass` it would match the * parsed nodes of `React.createClass` and `React["createClass"]`. */ matchesPattern(pattern: string, allowPartial?: boolean): boolean; /** * Check whether we have the input `key`. If the `key` references an array then we check * if the array has any items, otherwise we just check if it's falsy. */ has(key: string): boolean; isStatic(): boolean; /** Alias of `has`. */ is(key: string): boolean; /** Opposite of `has`. */ isnt(key: string): boolean; /** Check whether the path node `key` strict equals `value`. */ equals(key: string, value: any): boolean; /** * Check the type against our stored internal type of the node. This is handy when a node has * been removed yet we still internally know the type and need it to calculate node replacement. */ isNodeType(type: string): boolean; /** * This checks whether or not we're in one of the following positions: * * for (KEY in right); * for (KEY;;); * * This is because these spots allow VariableDeclarations AND normal expressions so we need * to tell the path replacement that it's ok to replace this with an expression. */ canHaveVariableDeclarationOrExpression(): boolean; /** * This checks whether we are swapping an arrow function's body between an * expression and a block statement (or vice versa). * * This is because arrow functions may implicitly return an expression, which * is the same as containing a block statement. */ canSwapBetweenExpressionAndStatement(replacement: Node): boolean; /** Check whether the current path references a completion record */ isCompletionRecord(allowInsideFunction?: boolean): boolean; /** * Check whether or not the current `key` allows either a single statement or block statement * so we can explode it if necessary. */ isStatementOrBlock(): boolean; /** Check if the currently assigned path references the `importName` of `moduleSource`. */ referencesImport(moduleSource: string, importName: string): boolean; /** Get the source code associated with this node. */ getSource(): string; /** Check if the current path will maybe execute before another path */ willIMaybeExecuteBefore(path: NodePath): boolean; // ------------------------- context ------------------------- call(key: string): boolean; isBlacklisted(): boolean; visit(): boolean; skip(): void; skipKey(key: string): void; stop(): void; setScope(): void; setContext(context: TraversalContext): NodePath; popContext(): void; pushContext(context: TraversalContext): void; // ------------------------- removal ------------------------- remove(): void; // ------------------------- modification ------------------------- /** Insert the provided nodes before the current one. */ insertBefore(nodes: Node | Node[]): any; /** * Insert the provided nodes after the current one. When inserting nodes after an * expression, ensure that the completion record is correct by pushing the current node. */ insertAfter(nodes: Node | Node[]): any; /** Update all sibling node paths after `fromIndex` by `incrementBy`. */ updateSiblingKeys(fromIndex: number, incrementBy: number): void; /** Hoist the current node to the highest scope possible and return a UID referencing it. */ hoist(scope: Scope): void; // ------------------------- family ------------------------- getOpposite(): NodePath; getCompletionRecords(): NodePath[]; getSibling(key: string | number): NodePath; getNextSibling(): NodePath; getPrevSibling(): NodePath; getAllPrevSiblings(): NodePath[]; getAllNextSiblings(): NodePath[]; get( key: K, context?: boolean | TraversalContext, ): T[K] extends Array ? Array> : T[K] extends Node | null | undefined ? NodePath : never; get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[]; getBindingIdentifiers(duplicates?: boolean): Node[]; getOuterBindingIdentifiers(duplicates?: boolean): Node[]; // ------------------------- comments ------------------------- /** Share comments amongst siblings. */ shareCommentsWithSiblings(): void; addComment(type: string, content: string, line?: boolean): void; /** Give node `comments` of the specified `type`. */ addComments(type: string, comments: any[]): void; // ------------------------- isXXX ------------------------- isArrayExpression(opts?: object): this is NodePath; isAssignmentExpression(opts?: object): this is NodePath; isBinaryExpression(opts?: object): this is NodePath; isDirective(opts?: object): this is NodePath; isDirectiveLiteral(opts?: object): this is NodePath; isBlockStatement(opts?: object): this is NodePath; isBreakStatement(opts?: object): this is NodePath; isCallExpression(opts?: object): this is NodePath; isCatchClause(opts?: object): this is NodePath; isConditionalExpression(opts?: object): this is NodePath; isContinueStatement(opts?: object): this is NodePath; isDebuggerStatement(opts?: object): this is NodePath; isDoWhileStatement(opts?: object): this is NodePath; isEmptyStatement(opts?: object): this is NodePath; isExpressionStatement(opts?: object): this is NodePath; isFile(opts?: object): this is NodePath; isForInStatement(opts?: object): this is NodePath; isForStatement(opts?: object): this is NodePath; isFunctionDeclaration(opts?: object): this is NodePath; isFunctionExpression(opts?: object): this is NodePath; isIdentifier(opts?: object): this is NodePath; isIfStatement(opts?: object): this is NodePath; isLabeledStatement(opts?: object): this is NodePath; isStringLiteral(opts?: object): this is NodePath; isNumericLiteral(opts?: object): this is NodePath; isNullLiteral(opts?: object): this is NodePath; isBooleanLiteral(opts?: object): this is NodePath; isRegExpLiteral(opts?: object): this is NodePath; isLogicalExpression(opts?: object): this is NodePath; isMemberExpression(opts?: object): this is NodePath; isNewExpression(opts?: object): this is NodePath; isProgram(opts?: object): this is NodePath; isObjectExpression(opts?: object): this is NodePath; isObjectMethod(opts?: object): this is NodePath; isObjectProperty(opts?: object): this is NodePath; isRestElement(opts?: object): this is NodePath; isReturnStatement(opts?: object): this is NodePath; isSequenceExpression(opts?: object): this is NodePath; isSwitchCase(opts?: object): this is NodePath; isSwitchStatement(opts?: object): this is NodePath; isThisExpression(opts?: object): this is NodePath; isThrowStatement(opts?: object): this is NodePath; isTryStatement(opts?: object): this is NodePath; isUnaryExpression(opts?: object): this is NodePath; isUpdateExpression(opts?: object): this is NodePath; isVariableDeclaration(opts?: object): this is NodePath; isVariableDeclarator(opts?: object): this is NodePath; isWhileStatement(opts?: object): this is NodePath; isWithStatement(opts?: object): this is NodePath; isAssignmentPattern(opts?: object): this is NodePath; isArrayPattern(opts?: object): this is NodePath; isArrowFunctionExpression(opts?: object): this is NodePath; isClassBody(opts?: object): this is NodePath; isClassDeclaration(opts?: object): this is NodePath; isClassExpression(opts?: object): this is NodePath; isExportAllDeclaration(opts?: object): this is NodePath; isExportDefaultDeclaration(opts?: object): this is NodePath; isExportNamedDeclaration(opts?: object): this is NodePath; isExportSpecifier(opts?: object): this is NodePath; isForOfStatement(opts?: object): this is NodePath; isImportDeclaration(opts?: object): this is NodePath; isImportDefaultSpecifier(opts?: object): this is NodePath; isImportNamespaceSpecifier(opts?: object): this is NodePath; isImportSpecifier(opts?: object): this is NodePath; isMetaProperty(opts?: object): this is NodePath; isClassMethod(opts?: object): this is NodePath; isObjectPattern(opts?: object): this is NodePath; isSpreadElement(opts?: object): this is NodePath; isSuper(opts?: object): this is NodePath; isTaggedTemplateExpression(opts?: object): this is NodePath; isTemplateElement(opts?: object): this is NodePath; isTemplateLiteral(opts?: object): this is NodePath; isYieldExpression(opts?: object): this is NodePath; isAnyTypeAnnotation(opts?: object): this is NodePath; isArrayTypeAnnotation(opts?: object): this is NodePath; isBooleanTypeAnnotation(opts?: object): this is NodePath; isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath; isNullLiteralTypeAnnotation(opts?: object): this is NodePath; isClassImplements(opts?: object): this is NodePath; isClassProperty(opts?: object): this is NodePath; isDeclareClass(opts?: object): this is NodePath; isDeclareFunction(opts?: object): this is NodePath; isDeclareInterface(opts?: object): this is NodePath; isDeclareModule(opts?: object): this is NodePath; isDeclareTypeAlias(opts?: object): this is NodePath; isDeclareVariable(opts?: object): this is NodePath; isExistentialTypeParam(opts?: object): this is NodePath; isFunctionTypeAnnotation(opts?: object): this is NodePath; isFunctionTypeParam(opts?: object): this is NodePath; isGenericTypeAnnotation(opts?: object): this is NodePath; isInterfaceExtends(opts?: object): this is NodePath; isInterfaceDeclaration(opts?: object): this is NodePath; isIntersectionTypeAnnotation(opts?: object): this is NodePath; isMixedTypeAnnotation(opts?: object): this is NodePath; isNullableTypeAnnotation(opts?: object): this is NodePath; isNumericLiteralTypeAnnotation(opts?: object): this is NodePath; isNumberTypeAnnotation(opts?: object): this is NodePath; isStringLiteralTypeAnnotation(opts?: object): this is NodePath; isStringTypeAnnotation(opts?: object): this is NodePath; isThisTypeAnnotation(opts?: object): this is NodePath; isTupleTypeAnnotation(opts?: object): this is NodePath; isTypeofTypeAnnotation(opts?: object): this is NodePath; isTypeAlias(opts?: object): this is NodePath; isTypeAnnotation(opts?: object): this is NodePath; isTypeCastExpression(opts?: object): this is NodePath; isTypeParameterDeclaration(opts?: object): this is NodePath; isTypeParameterInstantiation(opts?: object): this is NodePath; isObjectTypeAnnotation(opts?: object): this is NodePath; isObjectTypeCallProperty(opts?: object): this is NodePath; isObjectTypeIndexer(opts?: object): this is NodePath; isObjectTypeProperty(opts?: object): this is NodePath; isQualifiedTypeIdentifier(opts?: object): this is NodePath; isUnionTypeAnnotation(opts?: object): this is NodePath; isVoidTypeAnnotation(opts?: object): this is NodePath; isJSXAttribute(opts?: object): this is NodePath; isJSXClosingElement(opts?: object): this is NodePath; isJSXElement(opts?: object): this is NodePath; isJSXEmptyExpression(opts?: object): this is NodePath; isJSXExpressionContainer(opts?: object): this is NodePath; isJSXIdentifier(opts?: object): this is NodePath; isJSXMemberExpression(opts?: object): this is NodePath; isJSXNamespacedName(opts?: object): this is NodePath; isJSXOpeningElement(opts?: object): this is NodePath; isJSXSpreadAttribute(opts?: object): this is NodePath; isJSXText(opts?: object): this is NodePath; isNoop(opts?: object): this is NodePath; isParenthesizedExpression(opts?: object): this is NodePath; isAwaitExpression(opts?: object): this is NodePath; isBindExpression(opts?: object): this is NodePath; isDecorator(opts?: object): this is NodePath; isDoExpression(opts?: object): this is NodePath; isExportDefaultSpecifier(opts?: object): this is NodePath; isExportNamespaceSpecifier(opts?: object): this is NodePath; isRestProperty(opts?: object): this is NodePath; isSpreadProperty(opts?: object): this is NodePath; isExpression(opts?: object): this is NodePath; isBinary(opts?: object): this is NodePath; isScopable(opts?: object): this is NodePath; isBlockParent(opts?: object): this is NodePath; isBlock(opts?: object): this is NodePath; isStatement(opts?: object): this is NodePath; isTerminatorless(opts?: object): this is NodePath; isCompletionStatement(opts?: object): this is NodePath; isConditional(opts?: object): this is NodePath; isLoop(opts?: object): this is NodePath; isWhile(opts?: object): this is NodePath; isExpressionWrapper(opts?: object): this is NodePath; isFor(opts?: object): this is NodePath; isForXStatement(opts?: object): this is NodePath; isFunction(opts?: object): this is NodePath; isFunctionParent(opts?: object): this is NodePath; isPureish(opts?: object): this is NodePath; isDeclaration(opts?: object): this is NodePath; isLVal(opts?: object): this is NodePath; isLiteral(opts?: object): this is NodePath; isImmutable(opts?: object): this is NodePath; isUserWhitespacable(opts?: object): this is NodePath; isMethod(opts?: object): this is NodePath; isObjectMember(opts?: object): this is NodePath; isProperty(opts?: object): this is NodePath; isUnaryLike(opts?: object): this is NodePath; isPattern(opts?: object): this is NodePath; isClass(opts?: object): this is NodePath; isModuleDeclaration(opts?: object): this is NodePath; isExportDeclaration(opts?: object): this is NodePath; isModuleSpecifier(opts?: object): this is NodePath; isFlow(opts?: object): this is NodePath; isFlowBaseAnnotation(opts?: object): this is NodePath; isFlowDeclaration(opts?: object): this is NodePath; isJSX(opts?: object): this is NodePath; isNumberLiteral(opts?: object): this is NodePath; isRegexLiteral(opts?: object): this is NodePath; isReferencedIdentifier(opts?: object): this is NodePath; isReferencedMemberExpression(opts?: object): this is NodePath; isBindingIdentifier(opts?: object): this is NodePath; isScope(opts?: object): this is NodePath; isReferenced(opts?: object): boolean; isBlockScoped(opts?: object): this is NodePath; isVar(opts?: object): this is NodePath; isUser(opts?: object): boolean; isGenerated(opts?: object): boolean; isPure(opts?: object): boolean; // ------------------------- assertXXX ------------------------- assertArrayExpression(opts?: object): void; assertAssignmentExpression(opts?: object): void; assertBinaryExpression(opts?: object): void; assertDirective(opts?: object): void; assertDirectiveLiteral(opts?: object): void; assertBlockStatement(opts?: object): void; assertBreakStatement(opts?: object): void; assertCallExpression(opts?: object): void; assertCatchClause(opts?: object): void; assertConditionalExpression(opts?: object): void; assertContinueStatement(opts?: object): void; assertDebuggerStatement(opts?: object): void; assertDoWhileStatement(opts?: object): void; assertEmptyStatement(opts?: object): void; assertExpressionStatement(opts?: object): void; assertFile(opts?: object): void; assertForInStatement(opts?: object): void; assertForStatement(opts?: object): void; assertFunctionDeclaration(opts?: object): void; assertFunctionExpression(opts?: object): void; assertIdentifier(opts?: object): void; assertIfStatement(opts?: object): void; assertLabeledStatement(opts?: object): void; assertStringLiteral(opts?: object): void; assertNumericLiteral(opts?: object): void; assertNullLiteral(opts?: object): void; assertBooleanLiteral(opts?: object): void; assertRegExpLiteral(opts?: object): void; assertLogicalExpression(opts?: object): void; assertMemberExpression(opts?: object): void; assertNewExpression(opts?: object): void; assertProgram(opts?: object): void; assertObjectExpression(opts?: object): void; assertObjectMethod(opts?: object): void; assertObjectProperty(opts?: object): void; assertRestElement(opts?: object): void; assertReturnStatement(opts?: object): void; assertSequenceExpression(opts?: object): void; assertSwitchCase(opts?: object): void; assertSwitchStatement(opts?: object): void; assertThisExpression(opts?: object): void; assertThrowStatement(opts?: object): void; assertTryStatement(opts?: object): void; assertUnaryExpression(opts?: object): void; assertUpdateExpression(opts?: object): void; assertVariableDeclaration(opts?: object): void; assertVariableDeclarator(opts?: object): void; assertWhileStatement(opts?: object): void; assertWithStatement(opts?: object): void; assertAssignmentPattern(opts?: object): void; assertArrayPattern(opts?: object): void; assertArrowFunctionExpression(opts?: object): void; assertClassBody(opts?: object): void; assertClassDeclaration(opts?: object): void; assertClassExpression(opts?: object): void; assertExportAllDeclaration(opts?: object): void; assertExportDefaultDeclaration(opts?: object): void; assertExportNamedDeclaration(opts?: object): void; assertExportSpecifier(opts?: object): void; assertForOfStatement(opts?: object): void; assertImportDeclaration(opts?: object): void; assertImportDefaultSpecifier(opts?: object): void; assertImportNamespaceSpecifier(opts?: object): void; assertImportSpecifier(opts?: object): void; assertMetaProperty(opts?: object): void; assertClassMethod(opts?: object): void; assertObjectPattern(opts?: object): void; assertSpreadElement(opts?: object): void; assertSuper(opts?: object): void; assertTaggedTemplateExpression(opts?: object): void; assertTemplateElement(opts?: object): void; assertTemplateLiteral(opts?: object): void; assertYieldExpression(opts?: object): void; assertAnyTypeAnnotation(opts?: object): void; assertArrayTypeAnnotation(opts?: object): void; assertBooleanTypeAnnotation(opts?: object): void; assertBooleanLiteralTypeAnnotation(opts?: object): void; assertNullLiteralTypeAnnotation(opts?: object): void; assertClassImplements(opts?: object): void; assertClassProperty(opts?: object): void; assertDeclareClass(opts?: object): void; assertDeclareFunction(opts?: object): void; assertDeclareInterface(opts?: object): void; assertDeclareModule(opts?: object): void; assertDeclareTypeAlias(opts?: object): void; assertDeclareVariable(opts?: object): void; assertExistentialTypeParam(opts?: object): void; assertFunctionTypeAnnotation(opts?: object): void; assertFunctionTypeParam(opts?: object): void; assertGenericTypeAnnotation(opts?: object): void; assertInterfaceExtends(opts?: object): void; assertInterfaceDeclaration(opts?: object): void; assertIntersectionTypeAnnotation(opts?: object): void; assertMixedTypeAnnotation(opts?: object): void; assertNullableTypeAnnotation(opts?: object): void; assertNumericLiteralTypeAnnotation(opts?: object): void; assertNumberTypeAnnotation(opts?: object): void; assertStringLiteralTypeAnnotation(opts?: object): void; assertStringTypeAnnotation(opts?: object): void; assertThisTypeAnnotation(opts?: object): void; assertTupleTypeAnnotation(opts?: object): void; assertTypeofTypeAnnotation(opts?: object): void; assertTypeAlias(opts?: object): void; assertTypeAnnotation(opts?: object): void; assertTypeCastExpression(opts?: object): void; assertTypeParameterDeclaration(opts?: object): void; assertTypeParameterInstantiation(opts?: object): void; assertObjectTypeAnnotation(opts?: object): void; assertObjectTypeCallProperty(opts?: object): void; assertObjectTypeIndexer(opts?: object): void; assertObjectTypeProperty(opts?: object): void; assertQualifiedTypeIdentifier(opts?: object): void; assertUnionTypeAnnotation(opts?: object): void; assertVoidTypeAnnotation(opts?: object): void; assertJSXAttribute(opts?: object): void; assertJSXClosingElement(opts?: object): void; assertJSXElement(opts?: object): void; assertJSXEmptyExpression(opts?: object): void; assertJSXExpressionContainer(opts?: object): void; assertJSXIdentifier(opts?: object): void; assertJSXMemberExpression(opts?: object): void; assertJSXNamespacedName(opts?: object): void; assertJSXOpeningElement(opts?: object): void; assertJSXSpreadAttribute(opts?: object): void; assertJSXText(opts?: object): void; assertNoop(opts?: object): void; assertParenthesizedExpression(opts?: object): void; assertAwaitExpression(opts?: object): void; assertBindExpression(opts?: object): void; assertDecorator(opts?: object): void; assertDoExpression(opts?: object): void; assertExportDefaultSpecifier(opts?: object): void; assertExportNamespaceSpecifier(opts?: object): void; assertRestProperty(opts?: object): void; assertSpreadProperty(opts?: object): void; assertExpression(opts?: object): void; assertBinary(opts?: object): void; assertScopable(opts?: object): void; assertBlockParent(opts?: object): void; assertBlock(opts?: object): void; assertStatement(opts?: object): void; assertTerminatorless(opts?: object): void; assertCompletionStatement(opts?: object): void; assertConditional(opts?: object): void; assertLoop(opts?: object): void; assertWhile(opts?: object): void; assertExpressionWrapper(opts?: object): void; assertFor(opts?: object): void; assertForXStatement(opts?: object): void; assertFunction(opts?: object): void; assertFunctionParent(opts?: object): void; assertPureish(opts?: object): void; assertDeclaration(opts?: object): void; assertLVal(opts?: object): void; assertLiteral(opts?: object): void; assertImmutable(opts?: object): void; assertUserWhitespacable(opts?: object): void; assertMethod(opts?: object): void; assertObjectMember(opts?: object): void; assertProperty(opts?: object): void; assertUnaryLike(opts?: object): void; assertPattern(opts?: object): void; assertClass(opts?: object): void; assertModuleDeclaration(opts?: object): void; assertExportDeclaration(opts?: object): void; assertModuleSpecifier(opts?: object): void; assertFlow(opts?: object): void; assertFlowBaseAnnotation(opts?: object): void; assertFlowDeclaration(opts?: object): void; assertJSX(opts?: object): void; assertNumberLiteral(opts?: object): void; assertRegexLiteral(opts?: object): void; } export class Hub { constructor(file: any, options: any); file: any; options: any; } export interface TraversalContext { parentPath: NodePath; scope: Scope; state: any; opts: any; }