Directly indicate incorrect properties when assignment check fails #23530
Labels
Domain: Error Messages
The issue relates to error messaging
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
Suggestion
An idea for TypeScript
TypeScript Version: 2.8.1
Search Terms: type interface error underline squigglies messages
Code
Expected behavior:
There are two ways to describe this problem:
sampleInstance
doesn't adhere toComplexInterface
sampleInstance.recursion.recursion
doesn't adhere toComplexInterface
It would be useful if the red error squigglies visually directed the user towards the member actually causing the error.
Actual behavior:
The full error message traces the path with more indentation, but that's hard to parse through. I find it irritating to constantly switch between a cursor location in the code and the next level of indentation.
Visually, only one thing is squigglied:
Playground Link: https://www.typescriptlang.org/play/#src=interface%20ComplexInterface%20%7B%0D%0A%20%20%20%20booleanVal%3A%20boolean%3B%0D%0A%20%20%20%20numberVal%3A%20number%3B%0D%0A%20%20%20%20recursion%3F%3A%20ComplexInterface%3B%0D%0A%7D%0D%0A%0D%0Aconst%20sampleInstance%3A%20ComplexInterface%20%3D%20%7B%0D%0A%20%20%20%20booleanVal%3A%20false%2C%0D%0A%20%20%20%20numberVal%3A%200%2C%0D%0A%20%20%20%20recursion%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20booleanVal%3A%20true%2C%0D%0A%20%20%20%20%20%20%20%20numberVal%3A%201%2C%0D%0A%20%20%20%20%20%20%20%20recursion%3A%20%7B%7D%0D%0A%20%20%20%20%7D%2C%0D%0A%7D
Related Issues: #23393 #23515
The text was updated successfully, but these errors were encountered: