Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/plugin-transform-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ Replace the function used when compiling JSX fragment expressions. This is so th

`boolean`, defaults to `false`

:::caution Pending defaults change
The default value will be `true` in Babel 9.0.
:::

Added in: `v7.9.0`

When set to `true`, the transform will only remove [type-only imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-exports) (introduced in TypeScript 3.8). This should only be used if you are using TypeScript >= 3.8.
Expand Down
12 changes: 10 additions & 2 deletions docs/preset-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,17 @@ When it is set to `true`, Babel will provide a general TS plugin. If you want to

### `onlyRemoveTypeImports`

`boolean`, defaults to `false`
`boolean`, defaults to `true`

<details>
<summary>History</summary>

| Version | Changes |
| --- | --- |
| `v7.9.0` | Added `onlyRemoveTypeImports`, defaults to `false` |
| `v8.0.0` | defaults to `true` |

Added in: `v7.9.0`
</details>

When set to `true`, the transform will only remove [type-only imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-exports) (introduced in TypeScript 3.8). This should only be used if you are using TypeScript >= 3.8.

Expand Down
4 changes: 4 additions & 0 deletions docs/v8-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ Make sure to also check the [@babel/plugin-transform-typescript](#babel-plugin-t

**Migration**: The preset will also report invalid option names. Refer to the [docs](./preset-typescript.md#options) and ensure valid usage. For example, `runtime` is not a valid `preset-typescript` option and thus should be removed.

- `onlyRemoveTypeImports` defaults to `true` ([#12460](https://github.com/babel/babel/pull/12460))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaking change was accidentally introduced in babel/babel#12460. The older one does not contain this change.


**Migration**: If you use TypeScript < 3.8 or don't have `verbatimModuleSyntax` set to `true` in your TSConfig, specify `onlyRemoveTypeImports: false`.

### `@babel/plugin-transform-typescript` {#babel-plugin-transform-typescript}

![high](https://img.shields.io/badge/risk%20of%20breakage%3F-high-red.svg)
Expand Down