DefinitelyTyped/types/babel-plugin-macros/index.d.ts
Jake Runzer d4916b921d babel-plugin-macros: Export all types and fix References type (#41422)
* update babel-plugin-macros types to match docs

* babel-plugin-macros update version and ts version

* babel-plugin-macros update createMacro and MacroError types

* babel-plugin-macros: revert typescript version to 2.9
2020-01-09 11:41:01 -08:00

28 lines
804 B
TypeScript

// Type definitions for babel-plugin-macros 2.8
// Project: https://github.com/kentcdodds/babel-plugin-macros
// Definitions by: Billy Kwok <https://github.com/billykwok>
// Jake Runzer <https://github.com/coffee-cup>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
import * as Babel from '@babel/core';
export interface References {
[key: string]: Babel.NodePath[];
}
export interface Options {
configName?: string;
}
export interface MacroParams {
references: { default: Babel.NodePath[] } & References;
state: any;
babel: typeof Babel;
}
export type MacroHandler = (params: MacroParams) => void;
export class MacroError extends Error {}
export function createMacro(handler: MacroHandler, options?: Options): any;