mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
babel-traverse: Allow use of visitors with custom state types in calls to traverse
This commit is contained in:
8
types/babel-traverse/index.d.ts
vendored
8
types/babel-traverse/index.d.ts
vendored
@@ -8,9 +8,10 @@
|
||||
import * as t from 'babel-types';
|
||||
export type Node = t.Node;
|
||||
|
||||
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;
|
||||
noScope?: boolean;
|
||||
}
|
||||
@@ -353,7 +354,8 @@ export class NodePath<T = Node> {
|
||||
|
||||
buildCodeFrameError<TError extends Error>(msg: string, Error?: new (msg: string) => TError): TError;
|
||||
|
||||
traverse(visitor: Visitor, state?: any): void;
|
||||
traverse<T>(visitor: Visitor<T>, state: T): void;
|
||||
traverse(visitor: Visitor): void;
|
||||
|
||||
set(key: string, node: Node): void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user