It will complain that type of arg
is any
interface Foo {
foo(arg: string): void
}
class FooImpl implements Foo {
foo(arg) { console.log(arg) }
}
I can of course specify that it's string
but it's repetitive.
Maybe there's a way to tune TypeScript to make it infer that it's string
automatically?
Maybe there's a way to tune TypeScript to make it infer that it's string automatically
No. Here is the relevant TypeScript issue with reasons why its not there: https://github.com/Microsoft/TypeScript/issues/1373
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With