JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18608
  • Score
    100M100P100Q145900F
  • License MIT

Template functions to generate TypeScript AST.

Package Exports

  • talt

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (talt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Talt

Template functions to generate TypeScript AST .

Install

$ npm i talt typescript

Usage

import ts from "typescript";
import { template } from "talt";

const typeNode = template.type`{ hoge: number }`; // returns ts.TypeLiteralNode

const id = ts.factory.createIdentifier("Foo");

const typeNodeWithPlaceholder = template.type`{ hoge: ${id} }`; // returns `{ hoge: Foo }` type AST node

API

template has the following tag functions. Each tag function compiles and provides corresponding type AST.

  • template.type
  • template.expression
  • template.statement
  • template.sourceFile

License

MIT