yoavbls / pretty-ts-errors

🔵 Make TypeScript errors prettier and human-readable in VSCode 🎀
https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors
MIT License
13.14k stars 89 forks source link
astro deno errors svelte typescript vscode vscode-extension vue

Logo

Pretty TypeScript Errors

Make TypeScript errors prettier and human-readable in VSCode.

GitHub stars Visual Studio Code GitHub license Visual Studio Code Webstorm logo

TypeScript errors become messier as the complexity of types increases. At some point, TypeScript will throw on you a shitty heap of parentheses and "...".
This extension will help you understand what's going on. For example, in this relatively simple error:

   

Watch this

Watch theo's video

and others from: Web Dev Simplified, Josh tried coding, trash dev, and more

Features

Supports

Installation

code --install-extension yoavbls.pretty-ts-errors

Or simply by searching for pretty-ts-errors in the VSCode marketplace

Why isn't it trivial

  1. TypeScript errors contain types that are not valid in TypeScript.
    Yes, these types include things like ... more ..., { ... }, etc in an inconsistent manner. Some are also cutting in the middle because they're too long.
  2. Types can't be syntax highlighted in code blocks because the part of type X = ... is missing, so I needed to create a new TextMate grammar, a superset of TypeScript grammar called type.
  3. VSCode markdown blocks all styling options, so I had to find hacks to style the error messages. e.g., there isn't an inlined code block on VSCode markdown, so I used a code block inside a codicon icon, which is the only thing that can be inlined. That's why it can't be copied. but it isn't a problem because you can still hover on the error and copy things from the original error pane.

Hype section

Winning the Productivity Booster category at JSNation 2023

Tanner's tweet

Theo's tweet

Johnson's tweet

Stars from stars


Kent C. Dodds

Matt Pocock

Alex / KATT

Tanner Linsley

Theo Browne

Sponsorship

Every penny will be invested in other contributors to the project, especially ones that work
on things that I can't be doing myself like adding support to the extension for other IDEs 🫂

Contribution

Help by upvoting or commenting on issues we need to be resolved here
Any other contribution is welcome. Feel free to open any issue / PR you think.