blob: 582e014e4c18ce9db0bf05ae28c4a277e2e73e28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import type { Aliases, Node, VisitorKeys } from '@babel/types';
export type NodeOfType<T> = Extract<Node, { type: T }>;
export type NodeType = Node['type'] | keyof Aliases;
export type VisitorAction = 'ignore' | void;
export type Visitor<TNode extends Node> = <TParent extends Node>(
node: TNode,
parent: TParent | null,
parentKey: VisitorKeys[TParent['type']] | null,
listIdx: number | null
) => VisitorAction;
export type Visitors = { [TMethod in NodeType]?: Visitor<NodeOfType<TMethod>> };
export type IdentifierHandlerType = 'declare' | 'keep' | 'refer';
export type IdentifierHandlers = {
[key in IdentifierHandlerType]: [NodeType, ...string[]][];
};
|