Error messages are difficult to parse when class incorrectly implements an interface #1796
Labels
Suggestion
An idea for TypeScript
Too Complex
An issue which adding support for may be too complex for the value it adds
If a class incorrectly implements an interface which it explicitly claims to implement, the compiler produces "Argument of type '' is not assignable to parameter of type ''" at all the locations where an instance of the class is assigned to a variable or function parameter of the interface type.
This results in a lot of redundant error messages which obscure the root issue - the error message explaining why the class doesn't implement the interface.
I would suggest that if a class explicitly claims to implement an interface, that call-sites shouldn't issue errors about type incompatibilities.
eg. With this code:
Don't produce the "Argument of type 'WebServiceImpl' is not assignable to parameter of type 'WebServiceClient'" error at the doSomethingWithWebService() call, only the error for the WebServiceImpl implementation.
The text was updated successfully, but these errors were encountered: