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
Weekly downloads
472
decreased by-45.18%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.4.4 (2019-10-09)

Bug Fixes

  • check typeof decoratorsBeforeExport (336dc46)

Readme

Source

babel-preset-proposal-typescript

Travis Codecov Codacy Grade 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.

TOC

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
  13. v8intrinsic - Further Detail

Install

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

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

Options

optiondescriptiondefaults
classLoosewhether to use loose mode for class properties and private methodstrue
decoratorsBeforeExportSee Babel DocumentN/A
decoratorsLegacywhether to use legacy decorators semantictrue
isTSXwhether to enable jsx plugin with typescriptfalse, true but for /\.[jt]sx$/
pipelineOperatorimplementation of pipeline operator"minimal"

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

Keywords

FAQs

Last updated on 09 Oct 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