Socket
Socket
Sign inDemoInstall

babel-preset-proposal-typescript

Package Overview
Dependencies
86
Maintainers
2
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
700
increased by211.11%
Maintainers
2
Install size
6.13 MB
Created
Weekly downloads
 

Changelog

Source

2.0.0 (2021-01-26)

⚠ BREAKING CHANGES

  • bump babel and typescript, add two proposals

Features

  • bump babel and typescript, add two proposals (3f18e81)

Readme

Source

babel-preset-proposal-typescript

GitHub Actions Codecov Codacy Grade npm GitHub Release

David Peer David David Dev

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier codechecks.io

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-static-block
  2. class-properties
  3. do-expressions
  4. function-bind
  5. function-sent
  6. json-strings
  7. partial-application
  8. pipeline-operator
  9. private-methods
  10. private-property-in-object
  11. throw-expressions
  12. 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 Documentundefined
decoratorsLegacywhether to use legacy decorators semantictrue
isTSXwhether to enable jsx plugin with typescriptfalse, but true 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.

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

// if you prefer `ts-loader` or `awesome-typescript-loader`
loader = {
  test: /\.tsx?$/,
  use: [
    {
      loader: 'ts-loader',
    },
    {
      loader: 'babel-loader',
      options: {
        presets: ['proposal-typescript'],
      },
    },
  ],
}

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me

Keywords

FAQs

Last updated on 26 Jan 2021

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