Data Format Conversions

TypeScript to JavaScript Converter

Convert TypeScript to JavaScript with the official TypeScript compiler, running in your browser. Keep your formatting, comments and blank lines (types are removed in place), or compile to an older JavaScript version. TSX and JSX are supported.
Official TypeScript compilerRuns in your browser

Workspace

Options

Detected automatically from .tsx files and JSX tags.

How to use this tool

  1. 1Paste TypeScript or open a .ts / .tsx file.
  2. 2Keep formatting, or choose Compile and a JavaScript version.
  3. 3Fix any syntax errors shown with their line numbers.
  4. 4Copy the JavaScript or download the .js file.

Frequently asked questions

"Keep my formatting" removes only the type syntax, so the JavaScript looks like your code. "Compile with TypeScript" runs the full compiler, which can also lower modern syntax to an older JavaScript version but reformats the code.

They have no JavaScript equivalent, so those statements are compiled by TypeScript into plain objects; the rest of the file keeps its formatting. Constructor parameter properties become this.x = x assignments.

No. Like Babel, esbuild and Node's type stripping, it converts one file without type-checking. Syntax errors are reported with line numbers; run tsc in your project for type errors.

import type statements and imports used only as types are removed, as the TypeScript compiler does. Other imports are kept as they are.