import * as T from '@babel/types'; import { NodePath } from '@babel/traverse'; export type BabelPluginArguments = { types: typeof T; }; type BabelPluginVisitorFunction = (path: NodePath) => void; type BabelPluginVisitor = | BabelPluginVisitorFunction | { exit: BabelPluginVisitorFunction; }; export type BabelPlugin = ( options: BabelPluginArguments, ) => { visitor: { // This type is extendable, feel to add own visitor types. ImportDeclaration: BabelPluginVisitor; }; };