TSX to JSX Converter - Convert TypeScript React to JavaScript Online
Free online TSX to JSX converter tool to remove TypeScript type annotations and convert React TypeScript components to JavaScript.
How to Convert TSX to JSX - Step by Step Guide
Input Your TSX Code
Let's get your TSX into the converter! Whether you're simplifying a React component or removing TypeScript from your project, you have several convenient options:
Example: TSX Component Input
Here's a TypeScript React component with type annotations:
interface ButtonProps { label: string; onClick: (data?: any) => void; } function Button({ label, onClick }: ButtonProps) { return <button onClick={onClick}>{label}</button>; }
Automatic Type Removal
The conversion happens instantly! As soon as you input TSX, the converter automatically transforms TypeScript into clean JavaScript:
as, satisfies and the non-null !. Enums and constructor parameter properties are rewritten into the plain JavaScript TypeScript would produceExample: JSX Component Output
The same component, now without TypeScript types:
function Button({ label, onClick }) { return <button onClick={onClick}>{label}</button>; }
Review Clean JavaScript
Check the converted JavaScript code in the right editor. The converter thoroughly cleans:
Export Your JSX Component
Get your JavaScript React component ready for use! Multiple export options available:
Frequently Asked Questions
Why convert TSX to JSX?
You might need to convert TSX to JSX when simplifying a project, sharing code with teams that don't use TypeScript React, creating examples or demos, or migrating legacy codebases. Some teams prefer JavaScript for its simplicity and faster onboarding. This is especially common when working with Next.js applications or npm package distributions that target JavaScript users.
Which TypeScript features does it handle?
Interfaces, type aliases, annotations on variables, parameters and return values, generics (including the <T,> form used in arrow functions), as and satisfies casts, the non-null !, type-only imports and exports, overloads and declare blocks are all removed. A few things do something at runtime, so they are rewritten instead of deleted: an enum becomes the object TypeScript itself would emit, a constructor parameter like private api: Api turns into this.api = api, and import x = require('x') becomes a const. The one thing it won't do is a namespace that contains real code; you get a message pointing at the line.
Will my code still work after conversion?
It should behave the same, because only type information is taken out. The rest of the file, including formatting, comments, strings and numbers, is left exactly as you wrote it. Imports that were only used as types, such as FC or ReactNode, are dropped as well, the same way the TypeScript compiler does it. What you lose is compile-time checking, so run your tests or open the component in your dev server afterwards.
What happens if my code has a syntax error?
Nothing is converted until the code parses, so you never get half-converted output. The error box shows the line and column where the parser stopped, with that line printed underneath and a caret under the spot.
Can I convert an entire project?
This page works on one file at a time. For a whole codebase the TypeScript compiler can do the same job in one go: tsc --jsx preserve --target esnext --outDir out writes a .jsx file for every .tsx file (it does drop blank lines). Before you do, think about whether removing TypeScript is really the right move, because you'll lose type safety and a lot of editor help.
What about PropTypes?
The converter removes TypeScript types but doesn't automatically add PropTypes. If you want runtime prop validation in JavaScript, you'll need to manually add PropTypes definitions to your converted components. This is recommended for maintaining some level of type safety in JavaScript.
Is my code secure when using this tool?
The conversion runs in your browser with the Babel parser, so your code is never uploaded. Nothing is saved either: reload the page and the editor starts empty.
Related Tools
TSX Formatter
Format and beautify TSX/TypeScript React code with proper indentation
TSX Fixer
Fix broken TSX automatically, repair TypeScript React component errors, type annotations, and JSX syntax
HTML to TSX Converter
Convert HTML to TSX/TypeScript React format instantly
Markdown to TSX Converter
Convert Markdown to TypeScript React TSX components for type-safe content
TSX Validator
Validate TSX syntax and TypeScript React component structure
TSX Minifier
Minify TSX/TypeScript React code for production builds
TSX to HTML Converter
Convert React TypeScript TSX to standard HTML
TSX to JavaScript
Convert TypeScript JSX to React.createElement calls