How to Convert TSX to JSX - Step by Step Guide

Step 1

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:

•
Paste directly: Copy your React TypeScript component and paste it into the left editor
•
Upload a file: Click "Upload" to select a .tsx or .ts file from your computer
•
Try the sample: Click "Sample" to load an example and see how the converter works

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>;
}
Step 2

Automatic Type Removal

The conversion happens instantly! As soon as you input TSX, the converter automatically transforms TypeScript into clean JavaScript:

•
Removes interfaces: Strips all TypeScript interface declarations
•
Removes type annotations: Types on parameters, variables, class fields and return values go, along with as, satisfies and the non-null !. Enums and constructor parameter properties are rewritten into the plain JavaScript TypeScript would produce
•
Removes generic types: Strips generic type parameters from hooks and functions

Example: JSX Component Output

The same component, now without TypeScript types:

function Button({ label, onClick }) {
  return <button onClick={onClick}>{label}</button>;
}
Step 3

Review Clean JavaScript

Check the converted JavaScript code in the right editor. The converter thoroughly cleans:

•
Interface removal: All interface and type declarations are removed
•
Clean parameters: Function parameters are stripped of type annotations
•
Hook cleaning: useState, useEffect, and other hooks have generics removed
Step 4

Export Your JSX Component

Get your JavaScript React component ready for use! Multiple export options available:

•
Copy to clipboard: One-click copying to paste directly into your JavaScript project
•
Download as .jsx: Save as a JavaScript React file ready for your codebase
•
Checked output: before the result is shown it is parsed again as plain JavaScript with JSX, so leftover TypeScript is reported instead of slipping through

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.