TypeScript Formatter
Format TypeScript with Prettier standalone's TypeScript parser.
How to use
- Enter TypeScript source and run the formatter.
Capabilities and scope
The typescript and estree plugins structurally reflow source including type annotations.
How it works
prettier.format uses parser:'typescript' with the typescript and estree plugins.
Example
A compact type declaration is expanded into readable TypeScript formatting.
Useful for
- Normalize formatting in TS interfaces, types, and function snippets
Before you use it
- The TypeScript compiler is not run, so semantic type errors are not diagnosed.
Frequently asked questions
Does it report type errors?
No. Being parseable for formatting is different from passing TypeScript type checking.