-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Don't mention all the possible return types that permit no return statements #53560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -3619,7 +3615,7 @@ | |||
"category": "Error", | |||
"code": 2846 | |||
}, | |||
"A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.": { | |||
"A function with this return type needs to explicitly return a value.": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"must explicitly"? (Not sure what form we use most often)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pretend we're starting from scratch. What would you prefer to see as a user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this diagnostic, but I might be a bit confused when the return type is inferred. That's unrelated to the message per se though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do something like A function with return type 'X' needs to explicitly return a value.
? I think this would help with Maria's point about when the return type is inferred.
Do we still want to merge this? |
Fixes #53559.