microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.22k stars 12.39k forks source link

Colour coded error messages #50019

Open vdawg-git opened 2 years ago

vdawg-git commented 2 years ago

Suggestion

Typescript error messages can be a bit verbose sometimes. Color coding them and formatting them better (in reference to #45896) would greatly improve their readabillity.

πŸ” Search Terms

Colour code, color code, syntax highlighting, formatter, error messages

βœ… Viability Checklist

My suggestion meets these guidelines:

⭐ Suggestion

A plus: Colour coded visual difference for type errors, for example when unions do not match or a required property is missing.

πŸ“ƒ Motivating Example

Images speak a thousand lines of code (I messed up the formatting a bit. I did this by hand in an online tool..) big output difference

πŸ’» Use Cases

Overall useful as current error messages are hard to read, especially with big complex types.

orta commented 2 years ago

A small types highlighter is something I've been thinking about for the twoslash hovers in the site ( https://github.com/shikijs/twoslash/pull/159 ) which could perhaps feed two birds with one feeder.

vdawg-git commented 10 months ago

Any updates on this? Especially when working with a lot of generics or simply complex types, the error messages are very hard to read and this change would help a lot

vdawg-git commented 2 months ago

This VS Code plugin came to rescue: https://github.com/yoavbls/pretty-ts-errors?tab=readme-ov-file