JSPM

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

Yet another Babel preset for TypeScript, only transforms proposals which TypeScript does not support now.

Package Exports

  • babel-preset-proposal-typescript

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 (babel-preset-proposal-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-preset-ts

Greenkeeper badge

Yet another Babel preset for TypeScript, only transforms proposals which TypeScript does not support now.

So that you can use babel to transform proposals which are current in stage 0-2 and TypeScript team will not implement them temporarily.

For now only babel-plugin-transform-do-expressions and babel-plugin-transform-function-bind are included.

Install

npm install --save-dev babel-preset-proposal-typescript # npm
yarn add -D babel-preset-proposal-typescript # yarn

Usage

.babelrc

{
  "presets": ["proposal-typescript"]
}

Via CLI

babel input.ts --presets proposal-typescript > output.ts

Via Node API

require("@babel/core").transform("code", {
  presets: ["proposal-typescript"]
});

Via webpack

Pipe codes through babel-loader to ts-loader or awesome-typescript-loader.

loader = {
  test: /\.ts$/,
  use: [{
    loader: 'ts-loader'
  }, {
    loader: 'babel-loader',
    options: {
      presets: ['proposal-typescript']
    }
  }]
}