Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Parcel plugin to use @babel/plugin-transform-typescript instead of tsc

License

Notifications You must be signed in to change notification settings

Banou26/parcel-plugin-babel-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parcel plugin to use Babel instead of TSC

This plugin replace TSC by Babel allowing you to use any babel plugin magic inside .ts and .tsx files.

Example:

The proposal/plugin is going to be https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining

What it does is allow you to do undefined?.foo without it throwing an error.

You have to install my plugin and the babel plugins you want to use.

npm install parcel-plugin-babel-typescript @babel/plugin-proposal-optional-chaining

Then you need to add the babel configuration needed by my plugin, which is

.babelrc

{
  "presets": [
    "@babel/preset-typescript"
  ]
}

And the configuration needed by the babel plugin of your choice

.babelrc

{
  "presets": [
    "@babel/preset-typescript"
  ],
  "plugins": [
    "@babel/plugin-proposal-optional-chaining"
  ]
}

And voila, you can use TS/JSX features with Babel's magic at the same time !

const foo: number = 1
const bar = foo as unknown as string

const jsxStuff = <div></div>

const baz = undefined?.qux

About

Parcel plugin to use @babel/plugin-transform-typescript instead of tsc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published