Assignability error reporting should have a more specific error for unions #6541
Labels
Bug
A bug in TypeScript
Domain: Error Messages
The issue relates to error messaging
Help Wanted
You can do this
Milestone
Actual error:
Expected error:
Error reporting on unions doesn't mention that the compiler tried to assign the source to all branches of the target. Instead it proceeds to elaborate just the last branch's error. It should make it clear that the error elaboration is just one of several checks that failed.
Otherwise it is easy to assume that the compiler only tried the last branch and somehow skipped the "more promising" branch (which ultimately also fails, but at least contains the source type).
Based on one of the multiple issues reported by @Aleksey-Bykov in #6538.
The text was updated successfully, but these errors were encountered: