We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
function foo(): string { }
Currently in nightly, you'll get the error
error TS2847: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
But this error message is inaccurate, as you can now annotate with unknown.
unknown
In fact can't you now annotate with any type which is inhabited by undefined?
undefined
Pretty much, which means that if you wrote
function foo(): string | undefined { // oops, forgot to fill this in }
that'll be okay in TypeScript 5.1. You'll need to enable --noImplicitReturns to catch something like that.
--noImplicitReturns
Activity
fatcerberus commentedon Mar 28, 2023
In fact can't you now annotate with any type which is inhabited by
undefined
?DanielRosenwasser commentedon Mar 28, 2023
Pretty much, which means that if you wrote
that'll be okay in TypeScript 5.1. You'll need to enable
--noImplicitReturns
to catch something like that.