Data Format Conversions
JavaScript to TypeScript Converter
Workspace
Options
@param, @returns, @type and @typedef become TypeScript types.
Adds field declarations for this.x = … assignments.
How to use this tool
- 1Paste JavaScript or open a .js / .jsx file.
- 2Choose which conversions to apply.
- 3Review the notes: untyped parameters are listed so you can add types.
- 4Download the .ts (or .tsx) file.
Frequently asked questions
It always parses as TypeScript, and every type comes from your JSDoc or from obvious literals. Parameters without JSDoc are left as implicit any (or annotated as any/unknown if you choose), so strict mode may still ask you to add types — the notes count them.
TypeScript requires class properties to be declared. Fields assigned in the constructor are declared with their type; fields first set in other methods are declared optional (?).
For most code, yes. Default imports of CommonJS modules rely on "esModuleInterop": true, the default in new TypeScript projects. Turn the option off to keep require().
Yes. Files with JSX are converted to .tsx.
Related tools
TypeScript to JavaScript Converter
Convert TypeScript or TSX to JavaScript with the official compiler, keeping your formatting and comments.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or type aliases from sample JSON, with nested types and optional fields.
JavaScript to TXT Converter
Convert JavaScript source code to a clean .txt file, with optional comment removal, line numbers and whitespace clean-up.
Text Diff Checker
Compare two texts or files side by side or unified, by line, word or character, and download a unified patch.