TypeScript to JavaScript Converter
Convert TypeScript into plain JavaScript instantly. Types, interfaces and type-only imports are removed, enums become plain objects, and the rest of your code stays exactly as you wrote it.
How to Convert TypeScript to JavaScript
Quick answer: paste your TypeScript or open a file; the JavaScript appears below. Copy it or download the .js file.
-
1
Add your TypeScript
Paste it or open a file.
-
2
Choose options
Adjust the output on the right.
-
3
Check the JavaScript
Errors show the line number.
-
4
Copy or download
Save it as .js.
What You Get
What Is TypeScript?
TypeScript is JavaScript with type annotations, interfaces and enums. Types help catch mistakes while writing code, but browsers and many tools only run plain JavaScript, so TypeScript is turned into JavaScript before it runs.
What Is JavaScript?
JavaScript is the programming language of the web. Every browser runs it, as do servers, build tools and many apps. Plain JavaScript output can be pasted into a script tag, a code playground, a simple project without build tools or any place that does not understand types or JSX.
Why Convert TypeScript to JavaScript?
Sometimes you just need the JavaScript: to paste into a browser console or code playground, to share an example with someone who does not use TypeScript, to check what code a file really produces, or to use a snippet in a project without a build step. This converter removes the type layer in a fraction of a second.
How the Conversion Works
The code is read once and everything that only exists for type checking is removed: type annotations, interfaces, type aliases, generics, as casts and import type statements. Enums and parameter properties, which do produce code, are turned into their JavaScript equivalent. Modern syntax such as arrow functions, classes and optional chaining is left as written. Types are not checked, so the conversion works even with type errors.
Example
The sample's Product interface disappears, the Status enum becomes a small self-filling object, and the total and label functions keep their logic with all the type annotations removed.
Tips
Choose require() if the code will run in an older environment that does not understand import and export. Because types are removed without being checked, run your usual type checker in your project to catch type mistakes.
Who Uses It?
Developers sharing snippets, students learning TypeScript, and anyone who needs plain JavaScript quickly. Because the code never leaves the device, it is also safe for private and client projects.
Step by Step
Paste your TypeScript into the input box, drop a file onto it, or press Open File. The JavaScript appears in the output box straight away and updates as you type, so you can fix errors and see the effect immediately. Adjust the options on the right. When it looks right, press Copy to put the result on your clipboard, or Download to save it as a .js file. Press Sample to see a worked example first.
Using Your JavaScript
Save the result as a .js file or paste it into a script, a code playground or the browser console. If the code still contains import statements, load it as a module or choose the require() option. Keep the original source as your master copy, because the types and tags make it easier to work on.
About the Output
Import and export statements are kept by default, which suits modern browsers and bundlers. Choose require() to get CommonJS output for older environments and some server setups. Comments and blank lines in your code are kept where possible, so the result stays readable. Line numbers in the output may differ slightly from the source because removed type declarations leave fewer lines.
Private, Free and Instant
The converter is free, with no sign-up and no limit beyond the 5 MB text size. Everything runs in your browser, so private source code, client projects and unreleased work are never uploaded or stored. It works on Windows, Mac, Linux and Chromebooks, and on tablets and phones.
TypeScript to JavaScript: Stripping the Types
TypeScript adds static types to JavaScript. Browsers and Node run only JavaScript, so types are removed before code can run.
What disappears
Type annotations, interfaces, type aliases and generics are erased. Enums become objects, and newer syntax can be lowered to older versions. The behaviour at run time does not change.
Type errors are not reported by simple stripping, so keep a full compiler in your project. For React code, see TSX to JavaScript.
Frequently Asked Questions
Questions about TypeScript to JavaScript