A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://babeljs.io/docs/babel-plugin-syntax-typescript below:

@babel/plugin-syntax-typescript · Babel

@babel/plugin-syntax-typescript

note

Syntax only

Using this plugin directly only enables Babel to parse this syntax. If you want to remove TypeScript syntax then use the typescript plugin or typescript preset to both parse and transform this syntax.

npm install --save-dev @babel/plugin-syntax-typescript
yarn add --dev @babel/plugin-syntax-typescript
pnpm add --save-dev @babel/plugin-syntax-typescript
bun add --dev @babel/plugin-syntax-typescript
Usage With a configuration file (Recommended)

babel.config.json

{
"plugins": ["@babel/plugin-syntax-typescript"]
}
Via CLI

Shell

babel --plugins @babel/plugin-syntax-typescript script.js
Via Node API

JavaScript

require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-typescript"],
});
Options disallowAmbiguousJSXLike

boolean, defaults to false

Added in: v7.16.0

Even when JSX parsing is not enabled, this option disallows using syntax that would be ambiguous with JSX (<X> y type assertions and <X>() => {} type arguments). It matches the tsc behavior when parsing .mts and .mjs files.

dts

boolean, defaults to false

Added in: v7.20.0

This option will enable parsing within a TypeScript ambient context, where certain syntax have different rules (like .d.ts files and inside declare module blocks). Please see Official Handbook and TypeScript Deep Dive for more information about ambient contexts.

isTSX

boolean, defaults to false.

Forcibly enables jsx parsing. Otherwise angle brackets will be treated as typescript's legacy type assertion var foo = <string>bar;

tip

You can read more about configuring plugin options here


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4