Package Exports
- @babel/preset-typescript
- @babel/preset-typescript/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@babel/preset-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@babel/preset-typescript
Babel preset for TypeScript.
This preset includes the following plugins:
You will need to specify
--extensions ".ts"
for@babel/cli
&@babel/node
cli's to handle.ts
files.
Example
In
const x: number = 0;
Out
const x = 0;
Installation
npm install --save-dev @babel/preset-typescript
Usage
Via .babelrc
(Recommended)
.babelrc
{
"presets": ["@babel/preset-typescript"]
}
Via CLI
babel --presets @babel/preset-typescript script.ts
Via Node API
require("@babel/core").transform("code", {
presets: ["@babel/preset-typescript"]
});
Options
jsxPragma
string
Replace the function used when compiling JSX expressions.
This is so that we know that the import is not a type import, and should not be removed