@types/babel-template
Version:
TypeScript definitions for babel-template
39 lines (30 loc) • 1.79 kB
Markdown
# Installation
> `npm install --save @types/babel-template`
# Summary
This package contains type definitions for babel-template (https://github.com/babel/babel/tree/master/packages/babel-template).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-template.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel-template/index.d.ts)
````ts
// Type definitions for babel-template 6.25
// Project: https://github.com/babel/babel/tree/master/packages/babel-template, https://babeljs.io
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as t from "babel-types";
import { BabylonOptions } from "babylon";
type Node = t.Node;
// NB: This export doesn't match the handbook example, where `template` is the default export.
// But it does match the runtime behaviour (at least at the time of this writing). For some reason,
// babel-template/lib/index.js has this line at the bottom: module.exports = exports["default"];
export = template;
declare function template(code: string, opts?: BabylonOptions): UseTemplate;
type UseTemplate = (nodes?: { [placeholder: string]: Node }) => Node;
````
### Additional Details
* Last updated: Fri, 15 Sep 2023 19:06:48 GMT
* Dependencies: [@types/babel-types](https://npmjs.com/package/@types/babel-types), [@types/babylon](https://npmjs.com/package/@types/babylon)
* Global values: none
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), and [Marvin Hagemeister](https://github.com/marvinhagemeister).