UNPKG

1.95 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/babel-plugin-macros`
3
4# Summary
5This package contains type definitions for babel-plugin-macros (https://github.com/kentcdodds/babel-plugin-macros).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-plugin-macros.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-plugin-macros/index.d.ts)
10````ts
11// Type definitions for babel-plugin-macros 2.8
12// Project: https://github.com/kentcdodds/babel-plugin-macros
13// Definitions by: Billy Kwok <https://github.com/billykwok>
14// Jake Runzer <https://github.com/coffee-cup>
15// Ifiok Jr. <https://github.com/ifiokjr>
16// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17// Minimum TypeScript Version: 3.4
18
19import * as Babel from '@babel/core';
20
21export = babelPluginMacros;
22
23declare namespace babelPluginMacros {
24 interface References {
25 [key: string]: Babel.NodePath[];
26 }
27
28 interface Options {
29 configName?: string | undefined;
30 }
31
32 interface MacroParams {
33 references: { default: Babel.NodePath[] } & References;
34 state: Babel.PluginPass;
35 babel: typeof Babel;
36 config?: { [key: string]: any } | undefined;
37 }
38
39 type MacroHandler = (params: MacroParams) => void;
40
41 class MacroError extends Error {}
42
43 function createMacro(handler: MacroHandler, options?: Options): any;
44}
45
46declare function babelPluginMacros(babel: typeof Babel, options: any): Babel.PluginObj;
47
48````
49
50### Additional Details
51 * Last updated: Tue, 06 Jul 2021 18:05:39 GMT
52 * Dependencies: [@types/babel__core](https://npmjs.com/package/@types/babel__core)
53 * Global values: none
54
55# Credits
56These definitions were written by [Billy Kwok](https://github.com/billykwok), [Jake Runzer](https://github.com/coffee-cup), and [Ifiok Jr.](https://github.com/ifiokjr).
57
\No newline at end of file