convertCASEpro

MODE

TypeScript Formatter

Paste TypeScript and get it formatted with consistent style.

INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0

How the TypeScript Formatter works

The code is parsed with the TypeScript parser and printed with Prettier's rules, which cover type annotations, interfaces, union and intersection types, generics, enums, abstract classes, decorators and JSX in TSX files.

Options for indentation, quote style and semicolons let you match the conventions of your project. Parse errors are reported with their position.

When it is useful

  • •Formatting a snippet before posting it to an issue or forum.
  • •Making generated type definitions readable.
  • •Quickly checking that a type declaration parses.
  • •Applying a team style to code outside a configured project.

Frequently Asked Questions

Does it type check my code?

No. It checks syntax only, not whether types are correct.

Does it work with decorators and enums?

Yes, along with abstract classes, namespaces and other TypeScript specific syntax.

Can it format plain JavaScript?

TypeScript is a superset, so valid JavaScript works too, though the JavaScript Formatter is the more direct choice.

Related tools

[ Browse all tools ]