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