Mention "return type" in the error message when return type of a function is not matching the declared type #51449
Labels
Experience Enhancement
Noncontroversial enhancements
Help Wanted
You can do this
Suggestion
An idea for TypeScript
Milestone
Suggestion
π Search Terms
return type, error message
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Mention "return type" when return type of a function is not matching the declared type
When a parameter type is not matching the declared type, the error message has the words "parameter X" in it which makes it super easy to spot the error. For return types it only says type X is not compatible with type Y but is not clear that it is the return type
π Motivating Example
Playground
Error:
π» Use Cases
This can get tricky in very large and complex types. Just mentioning the word "return" can save a ton of time debugging issues
The text was updated successfully, but these errors were encountered: