Repository navigation
Simplify error messages against intersections of weak types #24146
Copy link
Copy link
Open
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Activity
- changed the title
[-]Simplify elaboration against intersections with weak types[/-][+]Simplify error messages against intersections with weak types[/+]on May 15, 2018 - changed the title
[-]Simplify error messages against intersections with weak types[/-][+]Simplify error messages against intersections of weak types[/+]on May 15, 2018 DanielRosenwasser commented
on May 15, 2018 MemberAuthorMore actionsKeep in mind that this needs to be tested against an intersection that consists of nothing but intersection types. We should never fall back to
never.- addedSuggestionAn idea for TypeScriptAn idea for TypeScriptIn DiscussionNot yet reached consensusNot yet reached consensus
on May 16, 2018 sandersn commented
on May 16, 2018 MemberMore actionsDaniel Rosenwasser (@DanielRosenwasser) I think you mean an intersection that consists of nothing but weak types.
Reacted by Daniel Rosenwasser- addedDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messaging
on May 16, 2018 - addedExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsand removedIn DiscussionNot yet reached consensusNot yet reached consensus
on Jul 29, 2019
Metadata
Metadata
Assignees
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
I spoke a bit with Nathan Shively-Sanders (@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.