-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version:
1.8
Code
// compiles
function foo(): number {
throw new Error('Everything is gonna be alright!');
}
// does not compile
const bar: () => number = () => {
throw new Error('WHYUNO?!?');
}
Expected behavior:
Functions foo
and bar
type-check, because an exception is thrown in their body which effectively means "bottom", so any return type should be permitted.
Actual behavior:
While function foo
type-checks, bar
does not.
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript