microsoft / microsoft/TypeScript
Differential `typeToString` / smarter error truncation
Open
@RyanCavanaugh is already working on this.
Since Feb 2, 2021.
Domain: Error Messages
Domain: LS: Type Display
Experience Enhancement
Experimentation Needed
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Lots of the time, error truncation will kick in at the most inopportune time, and lose relevant properties that will be subsequently elaborated on. @RyanCavanaugh has been thinking about a smarter version of this where we can inform our string writers to be a little smarter and not throw away the relevant members of a union, or properties of an object.
But there are some areas that we need to kind of think through and be wary of.
- don't repeat yourself: if you end up repeating a constituent of a union on the next line, then was it the best thing to focus on that part of the union on the prior line? You might avoid surprising a user ("where'd that type come from!?") but you're potentially not gaining anything. This leads us to
- don't lose the right information: error messages don't always go down the most-appropriate path. If we try to over-focus on the types that the error decided to elaborate on, we shouldn't lose relevant information from other possible types.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.