Closed
Description
Bug Report
🔎 Search Terms
implements
doesn't influence throw
function that only throws implicitly returns void
(I did find #7538 but there were no associated issues)
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries. I tried
4.3.5
as well asnext
⏯ Playground Link
Playground link with relevant code
💻 Code
interface Foo {
func(): number
}
class Bar implements Foo {
func() {
throw new Error("Bogus")
}
}
🙁 Actual behavior
Property 'func' in type 'Bar' is not assignable to the same property in base type 'Foo'.
Type '() => void' is not assignable to type '() => number'.
Type 'void' is not assignable to type 'number'.
🙂 Expected behavior
I expected () => number
to be used to inform Bar
's definition for func()
, since the interface sets the lower bound for acceptable return values.
Metadata
Metadata
Assignees
Labels
No labels