npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-preset-proposal-typescript

v4.0.0

Published

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

Downloads

3,121

Readme

babel-preset-proposal-typescript

GitHub Actions Codecov npm GitHub Release

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier changesets

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. async-do-expressions
  2. destructuring-private
  3. do-expressions
  4. duplicate-named-capturing-groups-regex
  5. function-bind
  6. function-sent
  7. import-defer
  8. import-wasm-source
  9. optional-chaining-assign
  10. partial-application
  11. pipeline-operator
  12. record-and-tuple
  13. regexp-modifiers
  14. throw-expressions
  15. v8intrinsic - Further Detail

Install

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

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

Options

| option | description | defaults | | ------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | | decoratorsBeforeExport | See Babel Document | undefined | | decoratorsLegacy | Whether to use legacy decorators semantic | true | | importDefer | Whether to enabled import-defer plugin, if true transform-modules-commonjs will be enabled automatically | false | | isTSX | Whether to enable jsx plugin with typescript | false, but true for /\.[jt]sx$/ | | optionalChainingAssignVersion | Version for optional-chaining-assign plugin, only '2023-07' allowed for now | '2023-07' | | pipelineOperator | Implementation of pipeline operator, minimal, smart or fsharp | minimal | | recordTuplePolyfill | Whether to enable import record-tuple plugin and polyfill, or specific the polyfill module name | true for Node>=14.6, it represents @bloomberg/record-tuple-polyfill | | recordTupleSyntaxType | record-tuple syntax, hash or bar | hash |

Usage

Note that unlike plugins, the presets are applied in an order of last to first (https://babeljs.io/docs/en/presets/#preset-ordering), so please make sure proposal-typescript is used at the last.

Via .babelrc (Recommended)

.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: ['@babel/typescript', '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'],
      },
    },
  ],
}

References

Sponsors

| 1stG | RxTS | UnTS | | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | 1stG Open Collective backers and sponsors | RxTS Open Collective backers and sponsors | UnTS Open Collective backers and sponsors |

Backers

Backers

| 1stG | RxTS | UnTS | | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | 1stG Open Collective backers and sponsors | RxTS Open Collective backers and sponsors | UnTS Open Collective backers and sponsors |

Changelog

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

License

MIT © JounQin@1stG.me