Skip to content

Colour coded error messages #50019

@vdawg-git

Description

@vdawg-git

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:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behaviour of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions