Is it possible to write a method that is an extension of a base class, but with a different return type, if supported by the shared interface, without adding a type declaration in class 'a'?
In practical terms, classes a & b exist in JavaScript files and are failing lint-ts-typing checks.
TypeScript definition file
interface x {
abc(): string | number;
}
JavaScript file
class a implements x {
abc() {
return 234;
}
}
class b extends a implements x {
abc() {
return '123';
}
}
throws the following:
Property 'abc' in type 'b' is not assignable to the same property in base type 'a'. Type '() => string' is not assignable to type '() => number'. Type 'string' is not assignable to type 'number'.