GithubHelp home page GithubHelp logo

nicebooty / pretty-ts-errors Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yoavbls/pretty-ts-errors

0.0 0.0 0.0 531 KB

๐Ÿ”ต Make TypeScript errors prettier and human-readable in VSCode ๐ŸŽ€

Home Page: https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors

License: MIT License

JavaScript 2.83% TypeScript 97.17%

pretty-ts-errors's Introduction

Logo

Pretty TypeScript Errors

Make TypeScript errors prettier and human-readable in VSCode.

Visual Studio Codeย GitHub licenseย visitor badge GitHub stars

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:

ย  ย 

Features

  • Syntax highlighting with your theme colors for types in error messages, supporting both light and dark themes
  • A button that leads you to the relevant type declaration next to the type in the error message
  • A button that navigates you to the error at typescript.tv, where you can find a detailed explanation, sometimes with a video
  • A button that navigates you to ts-error-translator, where you can read the error in plain English

Supports

  • Node and Deno TypeScript error reporters (in .ts files)
  • JSDoc type errors (in .js and .jsx files)
  • React, Solid and Qwik errors (in .tsx and .mdx files)
  • Astro, Svelte and Vue files when TypeScript is enabled (in .astro, .svelte and .vue files)

Watch it

Watch the video

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.

Contribution

Every contribution is welcome.
Feel free to ask anything and open any issue / PR you desire.

WTF

Thanks to these amazing folks and anyone else that help it reach so many people ๐Ÿ’™

That's great! https://t.co/gGX2TNKFqO pic.twitter.com/xu3i5GjC7H

โ€” Johnson Chu (@johnsoncodehk) April 12, 2023

s/o @yoavbls - this is dope https://t.co/wsI7gOxqC4

โ€” Theo - t3.gg (@t3dotgg) April 17, 2023

Typescript just got way better https://t.co/y8BQERWz7h

โ€” Tanner Linsley (@tannerlinsley) April 17, 2023

pretty-ts-errors's People

Contributors

dependabot[bot] avatar johnsoncodehk avatar yoavbls avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.