How can I overload a generic method with concrete type? It seems to work if I specify R at class level ie Foo but not at method's level.
class Foo {
find<R>(arg: R[]): R[] {
return arg;
}
}
class Bar extends Foo {
find(arg: string[]) {
return super.find(arg);
}
}
Gives the following error
Property 'find' in type 'Bar' is not assignable to the same property in base type 'Foo'. Type '(arg: string[]) => string[]' is not assignable to type '(arg: R[]) => R[]'. Types of parameters 'arg' and 'arg' are incompatible. Type 'R[]' is not assignable to type 'string[]'. Type 'R' is not assignable to type 'string'.(2416)