microsoft / microsoft/TypeScript

Avoid mentioning source types of object literals in error messages

Open
#35,250 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.