Socket
Socket
Sign inDemoInstall

babel-preset-proposal-typescript

Package Overview
Dependencies
87
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-preset-proposal-typescript

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


Version published
Maintainers
1
Install size
6.36 MB
Created

Changelog

Source

1.2.2 (2019-08-18)

Features

  • add options support, import documentation (e2c2064)

Readme

Source

babel-preset-proposal-typescript

Travis Codecov David Peer David David Dev

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.

Enabled proposal plugins

  1. class-properties
  2. do-expressions
  3. function-bind
  4. function-sent
  5. json-strings
  6. logical-assignment-operators
  7. nullish-coalescing-operator
  8. optional-chaining
  9. partial-application
  10. pipeline-operator
  11. private-methods
  12. throw-expressions

Install

# yarn
yarn add -D babel-preset-proposal-typescript

# npm
npm i -D babel-preset-proposal-typescript

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'],
      },
    },
  ],
}

Options

optiondescriptiondefaults
legacyDecoratorsuse legacy decorators semantictrue
isTsxenable jsx syntax for typescript['.jsx', '.tsx'].includes(ext)
pipelineOperatorimplementation of pipeline operatorminimal

Keywords

FAQs

Last updated on 18 Aug 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc