@types/babel-traverse
Advanced tools
Comparing version
@@ -5,4 +5,5 @@ // Type definitions for babel-traverse 6.25 | ||
// Marvin Hagemeister <https://github.com/marvinhagemeister> | ||
// Ryan Petrich <https://github.com/rpetrich> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
// TypeScript Version: 2.8 | ||
@@ -12,5 +13,6 @@ import * as t from 'babel-types'; | ||
export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; | ||
export default function traverse<S>(parent: Node | Node[], opts: TraverseOptions<S>, 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 { | ||
export interface TraverseOptions<S = Node> extends Visitor<S> { | ||
scope?: Scope; | ||
@@ -30,2 +32,3 @@ noScope?: boolean; | ||
/** Traverse node with current scope and path. */ | ||
traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void; | ||
traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void; | ||
@@ -345,6 +348,6 @@ | ||
parentKey: string; | ||
key: string; | ||
key: string | number; | ||
node: T; | ||
scope: Scope; | ||
type: string; | ||
type: T extends undefined | null ? string | null : string; | ||
typeAnnotation: object; | ||
@@ -360,3 +363,4 @@ | ||
traverse(visitor: Visitor, state?: any): void; | ||
traverse<T>(visitor: Visitor<T>, state: T): void; | ||
traverse(visitor: Visitor): void; | ||
@@ -380,6 +384,6 @@ set(key: string, node: Node): void; | ||
/** Get the parent function of the current path. */ | ||
getFunctionParent(): NodePath; | ||
getFunctionParent(): NodePath<t.Function>; | ||
/** Walk up the tree until we hit a parent node path in a list. */ | ||
getStatementParent(): NodePath; | ||
getStatementParent(): NodePath<t.Statement>; | ||
@@ -546,2 +550,5 @@ /** | ||
/** Check if the current path will maybe execute before another path */ | ||
willIMaybeExecuteBefore(path: NodePath): boolean; | ||
// ------------------------- context ------------------------- | ||
@@ -592,5 +599,11 @@ call(key: string): boolean; | ||
getSibling(key: string): NodePath; | ||
getSibling(key: string | number): NodePath; | ||
getAllPrevSiblings(): NodePath[]; | ||
getAllNextSiblings(): NodePath[]; | ||
get(key: string, context?: boolean | TraversalContext): NodePath; | ||
get<K extends keyof T>(key: K, context?: boolean | TraversalContext): | ||
T[K] extends Array<Node | null | undefined> ? Array<NodePath<T[K][number]>> : | ||
T[K] extends Node | null | undefined ? NodePath<T[K]> : | ||
never; | ||
get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[]; | ||
@@ -597,0 +610,0 @@ getBindingIdentifiers(duplicates?: boolean): Node[]; |
{ | ||
"name": "@types/babel-traverse", | ||
"version": "6.25.3", | ||
"version": "6.25.4", | ||
"description": "TypeScript definitions for babel-traverse", | ||
@@ -16,2 +16,7 @@ "license": "MIT", | ||
"githubUsername": "marvinhagemeister" | ||
}, | ||
{ | ||
"name": "Ryan Petrich", | ||
"url": "https://github.com/rpetrich", | ||
"githubUsername": "rpetrich" | ||
} | ||
@@ -22,3 +27,3 @@ ], | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
}, | ||
@@ -29,4 +34,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "078dd141e906090a3c297c762b3685506781efbd920d5916b1676f4b2c31e994", | ||
"typeScriptVersion": "2.3" | ||
"typesPublisherContentHash": "e05798a60aef68494cc2b5018e37d8b8130bd09555716cca2c671367a1da9c2b", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -8,6 +8,6 @@ # Installation | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-traverse | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-traverse | ||
Additional Details | ||
* Last updated: Tue, 28 Nov 2017 00:40:57 GMT | ||
* Last updated: Tue, 12 Jun 2018 03:36:26 GMT | ||
* Dependencies: babel-types | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Troy Gerwien <https://github.com/yortus>, Marvin Hagemeister <https://github.com/marvinhagemeister>. | ||
These definitions were written by Troy Gerwien <https://github.com/yortus>, Marvin Hagemeister <https://github.com/marvinhagemeister>, Ryan Petrich <https://github.com/rpetrich>. |
Sorry, the diff of this file is not supported yet
49578
0.15%866
1.41%