About the TypeScript to JavaScript tool
Sometimes you need plain JavaScript from TypeScript code: to paste an example into a project without a build step, run a snippet in the browser console, or share code with someone who doesn't use TypeScript. Deleting type annotations by hand is fiddly and easy to get wrong with generics and enums. This converter strips the types for you.
It uses Sucrase, a fast compiler that removes interfaces, type aliases, annotations, generics, as and satisfies expressions, and type-only imports. Enums are compiled to plain objects and constructor parameter properties such as constructor(private name: string) become normal assignments. For .tsx files you can keep the JSX as is, compile it to react/jsx-runtime calls, or use classic React.createElement. You can also convert ES module imports to CommonJS require, and tidy the result with Prettier.
This is a transpiler, not the TypeScript compiler: it does not type-check your code, and modern syntax such as optional chaining is kept rather than down-levelled. Everything runs in your browser.
How to use TypeScript to JavaScript
- Paste TypeScript into the input, open a .ts or .tsx file, or click “Load sample”.
- Choose the “File type”: .tsx for code with JSX, or .ts to allow <T>value style casts.
- For TSX, pick the “JSX output”: Keep JSX, react/jsx-runtime or React.createElement.
- Toggle “Convert imports to CommonJS” and “Tidy with Prettier”.
- Copy the JavaScript or download it as .js or .jsx.
Features
Removes all type syntax
Interfaces, types, generics, annotations, as, satisfies and type-only imports.
Compiles enums and parameter properties
TypeScript-only runtime features become equivalent JavaScript.
Three JSX modes
Preserve JSX, target the automatic runtime or classic createElement.
ESM or CommonJS
Keep import/export or convert them to require and exports.
Prettier formatting
Optionally reformats the output so it reads like hand-written JavaScript.
When to use it
- Share a TypeScript example with a team that uses plain JavaScript.
- Run a TS snippet in the browser console or Node REPL.
- Convert a .tsx component into .jsx for a JavaScript-only React project.
- Check what an enum or parameter property compiles to.
- Migrate small scripts away from a TypeScript build step.
Frequently asked questions
Does it check my types?
No. It only removes type syntax. Use tsc --noEmit or your editor to find type errors.
Which JavaScript version is the output?
The output keeps your modern syntax (ES2020 and later features such as ?. and ??). It does not down-level code for old browsers.
What is the difference between .ts and .tsx mode?
In .tsx mode angle brackets are JSX, so casts must be written with as. In .ts mode JSX is not allowed but <Type>value casts work.
Are const enums and namespaces supported?
Regular enums are converted. Const enums are compiled like regular enums rather than inlined, and namespaces containing values are not supported by Sucrase.
Is my code uploaded?
No. The conversion runs entirely in your browser.