TypeScript Formatter
runs in your browserno sign-upfree
Format and beautify TypeScript and TSX code with Prettier, with quote and semicolon options.
Formatting…
About this tool
This TypeScript formatter beautifies TypeScript and TSX with Prettier: type annotations, interfaces, generics, enums and decorators are all supported. Choose single or double quotes, semicolons and indentation, and copy consistently formatted code.
How to use
- Paste your TypeScript into the Input box. It is formatted as you type.
- Choose indent, line width, quote style and whether to use semicolons.
- Copy the formatted code or download it as a .ts file.
FAQ
Which formatter is used?
Prettier, the most widely used code formatter for web projects. It runs entirely in your browser, so your code is never uploaded.
Does it check types?
No. It checks syntax and formats the code, but does not run the TypeScript compiler, so type errors are not reported.
Does it support React (TSX)?
Yes. JSX inside TypeScript is formatted too.
What happens if my code has a syntax error?
The status line shows the problem with its line and column, and the error is marked in the editor. Fix it and the formatted result appears straight away.