-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Re-add undefined
assignability check
#53561
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
@@ -221,6 +222,8 @@ tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type | |||
// Functions with unknown return type don't need return expressions | |||
|
|||
function f27(): unknown { |
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.
Just to be sure: This error should be emitted because noImplicitReturns
is true
by default right?
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.
Actually no, this error is issued regardless of noImplicitReturns
. It occurs when there are no return
statements at all in the function body (i.e. when hasExplicitReturn
is false).
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.
Got it.
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.
Wait then this comment is incorrect.
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'm so confused. Can we get a playground link of what was desirable in TS 5.0, but is now incorrect in nightly?
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Can you explicitly add the test from: #53490 (comment) |
Will do, but why didn't this test catch it? |
Hm, that is effectively the right test, yes. It sounds like maybe everyone has a different idea about the desired behavior? Or, is this test's settings matrix missing |
Follow up to #53490 (refer to @ahejlsberg's comment).