Skip to content

Error for explicit return type with no return statements is misleadingΒ #53559

@DanielRosenwasser

Description

@DanielRosenwasser
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.

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions