Closed
Description
TypeScript Version: 2.7.0-dev.20180118
Search Terms: type inference, noimplicitAny
Code
interface ITest { a: number; }
abstract class Base {
protected abstract handle(foo: ITest): void;
}
class Child extends Base {
handle(bar) { }
}
Expected behavior:
argument bar
will have infered type ITest
Actual behavior:
error TS7006: Parameter 'bar' implicitly has an 'any' type.
Playground Link: Link
I know the bar
can have any type implements ITest
, but the strange thing is:
When I remove --noimplicitAny, tsserver will tell me bar
has a a
property. But with --noimplicitAny, tsserver can not tell me any thing but an error.
If bar can not have any other type do not implements ITest
, why not infer bar
as ITest
?