DevBolt
Processed in your browser. Your data never leaves your device.

TypeScript to JavaScript Converter

Strip TypeScript types, interfaces, enums, and generics to get clean JavaScript. Paste your .ts or .tsx code and get .js output instantly.

Samples:
.ts / .tsx

Ctrl+Enter to copy output · Conversion is instant as you type

Frequently Asked Questions

How does TypeScript to JavaScript conversion work?
The converter strips all TypeScript-specific syntax from your code, producing valid JavaScript. Type annotations (: string, : number) are removed from variables, parameters, and return types. Interface and type declarations are deleted entirely since they have no runtime equivalent. Generics (<T>) are removed from function and class definitions. Enum declarations are converted to plain JavaScript objects or constants. Access modifiers (public, private, protected) are stripped from class members. The as keyword for type assertions is removed. Non-null assertions (!) are removed. Optional chaining (?.) and nullish coalescing (??) are preserved since they are valid JavaScript syntax. The output is clean, runnable JavaScript.
What happens to TypeScript enums when converted to JavaScript?
TypeScript enums are one of the few TypeScript features that emit runtime JavaScript code. Numeric enums like enum Direction { Up, Down } become an immediately invoked function that creates a bidirectional mapping object where both Direction[0] returns "Up" and Direction["Up"] returns 0. String enums like enum Color { Red = 'red' } become a simpler object mapping. Const enums declared with const enum are inlined at usage sites and produce no runtime object at all, so they are fully removed during conversion. The converter reproduces the same JavaScript output that the TypeScript compiler would generate, ensuring identical runtime behavior.
What is the difference between TypeScript type stripping and transpilation?
Type stripping removes only TypeScript type syntax (annotations, interfaces, type aliases, generics) while preserving all JavaScript code exactly as written. The output matches the input structurally with types erased. Transpilation goes further by also transforming JavaScript syntax for older runtime targets: converting async/await to promises, optional chaining to ternary checks, class fields to constructor assignments, and modern syntax to equivalent older patterns. This tool performs type stripping by default, which is sufficient when your target runtime supports modern JavaScript. Node.js 22+ has native type stripping built in, meaning it can run TypeScript files directly by simply ignoring type annotations.

Related Convert Tools