-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: nightly (2.5.0-dev.20170629)
Code
interface I { m(): number; }
const o: I = { m() { throw new Error("not implemented"); } }Expected behavior:
No error.
Actual behavior:
Type '() => void' is not assignable to type '() => number'.
The same problem occurs inside a class. Manually annotating m(): number fixes the problem, but shouldn't we get that from the contextual type anyway?
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript