`@babel/preset-typescript` is a Babel preset specifically designed to strip TypeScript syntax from source code, converting it into standard JavaScript. It does not perform any type checking; its sole purpose is to remove type annotations, enums, and other TypeScript-specific constructs so that Babel can continue processing the resulting JavaScript. This allows developers to leverage Babel's extensive plugin ecosystem for further transformations, such as targeting older JavaScript environments with `@babel/preset-env` or integrating JSX transformations. The package is part of the Babel monorepo, maintaining an active release schedule with frequent patch and minor updates (often bi-weekly) and new major versions released periodically. As of April 2026, the `7.x` series is stable, with `7.29.2` being a recent patch, while the `8.x` series is in a release candidate phase, with `8.0.0-rc.3` being the latest. Its primary differentiator is enabling a unified transformation pipeline for projects using TypeScript in conjunction with various Babel features that the TypeScript compiler alone does not provide.
npm install babel-preset-typescriptVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `@babel/preset-typescript` with `@babel/core` to strip TypeScript syntax and transpile to JavaScript, showing a simple class and type annotation.
Integrate a separate type-checking step into your build process using the TypeScript compiler (`tsc --noEmit`) to ensure type safety.
Migrate away from `module <identifier>` declarations to standard ES module imports/exports or the `namespace` keyword if appropriate for your use case.
Ensure the order in your `presets` array is `['@babel/preset-typescript', ...otherPresets]` so that TypeScript syntax is stripped before other transformations occur.
Run `npm install --save-dev @babel/preset-typescript` or `yarn add --dev @babel/preset-typescript`. In your `.babelrc.json` or `babel.config.js`, ensure the preset is listed as `"@babel/preset-typescript"` or `['@babel/preset-typescript', {...}]`.Install `@babel/preset-env` (`npm install --save-dev @babel/preset-env`) and include it in your Babel configuration, typically after `babel-preset-typescript`. Example: `presets: [['@babel/preset-typescript'], ['@babel/preset-env', { targets: { node: 'current' }}]]`.If your `babel.config.js` or similar file is in an ES module context, use `import` statements instead of `require()`. For Babel presets, this might look like `import presetTypescript from '@babel/preset-typescript'; export default { presets: [presetTypescript] };`.