Closed
Description
In TypeScript 3.0, we're aiming for a better error message experience all around.
One of the related efforts we've been working on is related error spans: #25257.
However, in addition to that, we've received enough constructive feedback about error messages that we can act on.
TypeScript 3.0
- Better JSX attribute errors (Better JSX property error messages #23117)
- Better errors on object properties (Error spans are not close enough to missing properties on deeply nested object literals #22170, Related error spans for assignability checks #25030)
- Smarter elaborations when assigning
Foo<T>
toFoo<U> | Bar<V>
(Use type references for better error messages when relating to a union type #24776) - Smarter elaborations when assigning objects to
Foo | Bar[]
(When relating object literal types to unions, avoid elaborating on Array/ReadonlyArray #25750 ) - Better guidance for non-existent deep imports (Poor error guidance for deep imports of packages with @types #24781)
- Better errors on always true/false conditions (Confusing error message: Operator '===' cannot be applied to types '1' and '0'. #25245)
- Smarter elaborations against
Foo | null | undefined
(Skip ahead on error elaboration forsource
->target | null | undefined
when source is atomic #25086) - Better truncation on big types (Better type truncation in error messages #24778)
- Better duplicate declaration errors (Limit duplicate declaration errors #25324)
TypeScript 3.x
These suggested improvements didn't make it in time for 3.0, but we'll hopefully continue working on them! Check out #26077 to keep track of them.
- Better hints for uncalled types ("Did you forget to call 'X'?" for assignability errors #25308)
- Better hints for 'cannot find name' errors (Better hints for 'cannot find name' errors #25309)
- Better errors on weak type intersections like
IntrinsicAttributes
(Simplify error messages against intersections of weak types #24146 🏃♂️) - Better errors when matching implementation signatures (If call doesn’t resolve to an overload signature, issue a better error when the implementation would work #25488)
Collapsing identical errors (Consider collapsing multiple repeated type-related error messages when in --pretty #23393)- Subsumed by Limit duplicate declaration errors #25324.