DefinitelyTyped/types/babel-plugin-macros/babel-plugin-macros-tests.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

15 lines
461 B
TypeScript

import { createMacro, MacroError, References, Options, MacroParams, MacroHandler } from 'babel-plugin-macros';
const macro = createMacro(
({ references, state, babel }) => {
Object.keys(references).forEach(() => {});
references.default.forEach(() => {});
state.abc = 123;
babel.parse("console.log('Hello world!')");
throw new MacroError('testing');
},
{ configName: 'test' },
);
macro() === 'Hello world!';