Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Better/more easily decipherable errors #30320

Closed
ffxsam opened this issue Mar 11, 2019 · 3 comments
Closed

Proposal: Better/more easily decipherable errors #30320

ffxsam opened this issue Mar 11, 2019 · 3 comments
Labels
Unactionable There isn't something we can do with this issue

Comments

@ffxsam
Copy link

ffxsam commented Mar 11, 2019

I would personally like to see TS spit out errors that are a bit more easy to decipher. In some cases,
errors can get quite ridiculous:

https://gist.github.com/ffxsam/966b71ea3c03ea95ee66c273895ac260

And I'm left scratching my head, because I can't make heads or tails of what the actual problem is.

@RyanCavanaugh RyanCavanaugh added the Unactionable There isn't something we can do with this issue label Mar 11, 2019
@DanielRosenwasser
Copy link
Member

We would too, but there's really nothing we can do without something concrete to work with. With enough examples, maybe we could start to see a common pattern, but as an example this specific issue lacks a code sample to go with it.

@ffxsam
Copy link
Author

ffxsam commented Mar 12, 2019

Of course (as is always the case), it's in a closed-source project, and I'm not able to replicate it. Feel free to close this issue.

I think one simple thing that could help is to simply print the innermost type error. As an analogy, let's say I've built a house, and I installed the wrong type of kitchen sink in my kitchen. TypeScript seems to dump out errors in this fashion:

  • The house is the wrong type
  • The inner structure is the wrong type
  • Floor 1 is the wrong type
  • Kitchen is the wrong type
  • Sink is the wrong type

Of course, this is simplified quite a bit, as each step shows a lot more detail with it that tends to be overwhelming and difficult to read. It spells out the entire type, rather than pinpointing the exact problem. It would be preferable to just skip all the excess and say "sink is the wrong type". Maybe there's something useful I'm missing in the way it reports errors now, but I think legibility could still be improved somehow.

@RyanCavanaugh
Copy link
Member

If one error ordering were always better than the other, we would have switched by now. See #29759 (comment) for an example and other discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unactionable There isn't something we can do with this issue
Projects
None yet
Development

No branches or pull requests

3 participants