@types/babel__traverse
Advanced tools
Comparing version 7.0.10 to 7.0.11
@@ -11,3 +11,3 @@ // Type definitions for @babel/traverse 7.0 | ||
import * as t from "@babel/types"; | ||
import * as t from '@babel/types'; | ||
@@ -45,3 +45,3 @@ export type Node = t.Node; | ||
hub: Hub; | ||
bindings: { [name: string]: Binding; }; | ||
bindings: { [name: string]: Binding }; | ||
@@ -110,8 +110,3 @@ /** Traverse node with current scope and path. */ | ||
push(opts: { | ||
id: t.LVal, | ||
init?: t.Expression, | ||
unique?: boolean, | ||
kind?: "var" | "let" | "const", | ||
}): void; | ||
push(opts: { id: t.LVal; init?: t.Expression; unique?: boolean; kind?: 'var' | 'let' | 'const' }): void; | ||
@@ -152,7 +147,13 @@ getProgramParent(): Scope; | ||
export class Binding { | ||
constructor(opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; kind: "var" | "let" | "const"; }); | ||
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"; | ||
kind: 'var' | 'let' | 'const' | 'module'; | ||
referenced: boolean; | ||
@@ -165,7 +166,9 @@ references: number; | ||
export type Visitor<S = {}> = VisitNodeObject<S, Node> & { | ||
[Type in Node["type"]]?: VisitNode<S, Extract<Node, { type: Type; }>>; | ||
} & { | ||
[K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]> | ||
}; | ||
export type Visitor<S = {}> = VisitNodeObject<S, Node> & | ||
{ | ||
[Type in Node['type']]?: VisitNode<S, Extract<Node, { type: Type }>>; | ||
} & | ||
{ | ||
[K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]>; | ||
}; | ||
@@ -252,3 +255,3 @@ export type VisitNode<S, P> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>; | ||
paths: NodePath[], | ||
filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath | ||
filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath, | ||
): NodePath; | ||
@@ -294,6 +297,6 @@ | ||
*/ | ||
replaceWithSourceString(replacement: any): void; | ||
replaceWithSourceString(replacement: any): [NodePath]; | ||
/** Replace the current node with another. */ | ||
replaceWith(replacement: Node | NodePath): void; | ||
replaceWith<T extends Node>(replacement: T | NodePath<T>): [NodePath<T>]; | ||
@@ -305,5 +308,5 @@ /** | ||
*/ | ||
replaceExpressionWithStatements(nodes: Node[]): Node; | ||
replaceExpressionWithStatements<Nodes extends Node[]>(nodes: Nodes): NodePaths<Nodes>; | ||
replaceInline(nodes: Node | Node[]): void; | ||
replaceInline<Nodes extends Node | Node[]>(nodes: Nodes): NodePaths<Nodes>; | ||
@@ -469,6 +472,10 @@ // ------------------------- evaluation ------------------------- | ||
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<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[]; | ||
@@ -475,0 +482,0 @@ |
{ | ||
"name": "@types/babel__traverse", | ||
"version": "7.0.10", | ||
"version": "7.0.11", | ||
"description": "TypeScript definitions for @babel/traverse", | ||
@@ -44,4 +44,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "fe6e56e3c2de4994d8953091fad2b308dcb631f61e0350e10a109b581f887529", | ||
"typesPublisherContentHash": "9dbc1fdf9406edda1d6b63b712e5b312a5c2aaa27ed9ce8e70a6f6130c7a65a3", | ||
"typeScriptVersion": "3.4" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 06 Apr 2020 19:08:21 GMT | ||
* Last updated: Mon, 27 Apr 2020 21:43:26 GMT | ||
* Dependencies: [@types/babel__types](https://npmjs.com/package/@types/babel__types) | ||
@@ -14,0 +14,0 @@ * Global values: none |
Sorry, the diff of this file is not supported yet
41677
731