Don't error when function has an implicit return but its return type is assignable to undefined - #53490
Conversation
This reverts commit 2f36455.
|
I don't think this is the right fix for the issue. The following now doesn't error: function foo(x: boolean): string | undefined {
}This previously would report "A function whose declared type is neither 'void' nor 'any' must return a value." |
|
The right fix is to put the assignability check back where it was originally. |
|
Specifically, we need to undo the change I mention here. And then also undo the change in this PR. |
|
I'm confused with Jake Bailey (@jakebailey)'s comment. Is this a fix or a bug? 😄 |
Is what a fix or a bug? |
Anders Hejlsberg (@ahejlsberg) Sorry I wasn't clear, I was referring to this PR. The way I read Jake's comment, this change fixes the issue you brought up here, but you're suggesting we undo it. |
|
Got it, thanks for explaining! I can prepare that change. |
Fixes #53473