UNPKG

929 BTypeScriptView Raw
1// Type definitions for babel-template 6.25
2// Project: https://github.com/babel/babel/tree/master/packages/babel-template, https://babeljs.io
3// Definitions by: Troy Gerwien <https://github.com/yortus>
4// Marvin Hagemeister <https://github.com/marvinhagemeister>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6// TypeScript Version: 2.8
7
8import { BabylonOptions } from 'babylon';
9import * as t from 'babel-types';
10type Node = t.Node;
11
12// NB: This export doesn't match the handbook example, where `template` is the default export.
13// But it does match the runtime behaviour (at least at the time of this writing). For some reason,
14// babel-template/lib/index.js has this line at the bottom: module.exports = exports["default"];
15export = template;
16declare function template(code: string, opts?: BabylonOptions): UseTemplate;
17
18type UseTemplate = (nodes?: {[placeholder: string]: Node}) => Node;