microsoft / microsoft/TypeScript
Avoid mentioning source types of object literals in error messages
Open
Nobody has claimed this yet.
Domain: Error Messages
Experience Enhancement
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Whenever a type that originates from an object literal is encountered, we should avoid writing out the whole type. It's rarely useful, and can get painful in a lot of contexts (think React Native styles objects).
- Type '{ goobledeyGock: string, tickTock: number, wakkaFlocka: { stuff: string } }' is not assignable to 'OneType | AnotherType'.
+ This object is not assignable to 'OneType | AnotherType'.
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.
Research direction
Start in the TypeScript typechecker and use the issue's object-literal diagnostic example as the behavior to investigate. Determine how object-literal source types are identified and how the diagnostic should omit their full structure; done means matching the shorter wording while preserving useful target-type information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100