Simplify error messages against intersections of weak types #24146
Labels
Domain: Error Messages
The issue relates to error messaging
Experience Enhancement
Noncontroversial enhancements
Suggestion
An idea for TypeScript
Milestone
I spoke a bit with @sandersn about ways we can tackle the type madness issue (#14662). I noted that JSX scenarios are much more broadly applicable right now and are pretty prevalent given the sorts of type arithmetic we see a lot of in the React community. 😃
Problem: JSX optional attributes make errors too hard to read
Proposal
When doing relation checks against an intersection target, if a check fails, see if relating against the same type with weak types removed would result in the same outcome. If so, use that comparison when elaborating types.
The great part is that this actually solves a broader set of problems than just JSX.
The text was updated successfully, but these errors were encountered: