1 | # Installation
|
2 | > `npm install --save @types/babel-template`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for babel-template (https://github.com/babel/babel/tree/master/packages/babel-template).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-template.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-template/index.d.ts)
|
10 | ````ts
|
11 | import * as t from "babel-types";
|
12 | import { BabylonOptions } from "babylon";
|
13 | type Node = t.Node;
|
14 |
|
15 | // NB: This export doesn't match the handbook example, where `template` is the default export.
|
16 | // But it does match the runtime behaviour (at least at the time of this writing). For some reason,
|
17 | // babel-template/lib/index.js has this line at the bottom: module.exports = exports["default"];
|
18 | export = template;
|
19 | declare function template(code: string, opts?: BabylonOptions): UseTemplate;
|
20 |
|
21 | type UseTemplate = (nodes?: { [placeholder: string]: Node }) => Node;
|
22 |
|
23 | ````
|
24 |
|
25 | ### Additional Details
|
26 | * Last updated: Mon, 06 Nov 2023 22:41:04 GMT
|
27 | * Dependencies: [@types/babel-types](https://npmjs.com/package/@types/babel-types), [@types/babylon](https://npmjs.com/package/@types/babylon)
|
28 |
|
29 | # Credits
|
30 | These definitions were written by [Troy Gerwien](https://github.com/yortus), and [Marvin Hagemeister](https://github.com/marvinhagemeister).
|
31 |
|
\ | No newline at end of file |