@babel/preset-typescript

    In

    Out

    1. const x = 0;
    1. {
    2. "presets": ["@babel/preset-typescript"]
    3. }

    Via CLI

    Via Node API

    1. presets: ["@babel/preset-typescript"],

    boolean, defaults to false

    Forcibly enables jsx parsing. Otherwise angle brackets will be treated as typescript’s legacy type assertion var foo = <string>bar;. Also, isTSX: true requires allExtensions: true.

    jsxPragma

    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.

    allExtensions

    , defaults to false

    Indicates that every file should be parsed as TS or TSX (depending on the isTSX option).

    boolean, uses the default set by @babel/plugin-transform-typescript.

    Enables compilation of TypeScript namespaces.

    allowDeclareFields

    When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:

    onlyRemoveTypeImports

    boolean, defaults to false

    When set to true, the transform will only remove (introduced in TypeScript 3.8). This should only be used if you are using TypeScript >= 3.8.