How to Migrate a TypeScript Project to JavaScript
Migrating from TypeScript back to JavaScript involves stripping types, renaming files, and updating build tooling. This guide covers the complete process for projects of any size.
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.
Ctrl+Enter to copy output · Conversion is instant as you type
Step 1: Strip types from all files
Use the TypeScript compiler (tsc --outDir dist) to emit JavaScript files, or use a faster tool like esbuild or sucrase for type-only stripping. For individual files, paste them into this converter tool. The key transformation is removing type annotations, interfaces, type aliases, and generics while preserving all runtime code.
Step 2: Handle TypeScript-specific features
Some TypeScript features need manual conversion: enums become plain objects or string constants, decorators need a Babel plugin or manual refactoring, namespace declarations become IIFEs or modules, and 'import type' statements are simply deleted. Parameter properties (constructor(public name: string)) must be converted to explicit field assignments.
Step 3: Update project configuration
Remove tsconfig.json (or keep it for editor support with 'checkJs'). Update build scripts to remove the tsc step. Rename files from .ts/.tsx to .js/.jsx. Update imports that reference .ts extensions. Remove @types/* devDependencies that are no longer needed. Consider adding JSDoc type annotations for editor support without TypeScript.
Frequently Asked Questions
Why would I migrate from TypeScript back to JavaScript?
Common reasons: simplifying the build pipeline (especially for small projects), reducing onboarding complexity for new contributors, following a project's decision to use JSDoc types instead, or extracting code for environments without TypeScript support. Some open-source projects (like Svelte) have migrated from TS to JSDoc-typed JS.
Can I keep type checking without TypeScript files?
Yes. Use JSDoc comments with TypeScript's checkJs option: add // @ts-check at the top of .js files and write types in /** @type {string} */ comments. This gives you type checking in VS Code without .ts files or a build step.
Related Convert Tools
GraphQL to TypeScript
Convert GraphQL SDL schemas to TypeScript interfaces, types, enums, unions, and operations
JSON to SQL Converter
Convert JSON arrays to SQL CREATE TABLE and INSERT statements for PostgreSQL, MySQL, and SQLite with automatic type inference
SQL to TypeScript/Prisma/Drizzle
Convert SQL CREATE TABLE statements to TypeScript interfaces, Prisma schema, and Drizzle ORM definitions for PostgreSQL, MySQL, and SQLite
ESLint to Biome Converter
Convert your ESLint config to Biome — maps 100+ rules from core, TypeScript, React, JSX-A11y, and import plugins to biome.json