Since #33860 we get false compile errors when spying on overloaded methods.
Minimal example:
interface I {
f(): string;
f(x: any): number;
}
const spyObject = jasmine.createSpyObj<I>("spyObject", ["f"]);
spyObject.f.and.returnValue("a string, erroneously required to be a number");
Results in:
TS2345: Argument of type '"a string, erroneously required to be a number"' is not assignable to parameter of type 'number'.
Our expectation: The accepted parameter type of returnValue should be string | number, not only number.
(Unfortunately the problematic method overloading (as demonstrated in the I example interface) occurs in external libraries we use, so we can't change that part.)
CC PR author: @kolodny
Since #33860 we get false compile errors when spying on overloaded methods.
Minimal example:
Results in:
Our expectation: The accepted parameter type of
returnValueshould bestring | number, not onlynumber.(Unfortunately the problematic method overloading (as demonstrated in the
Iexample interface) occurs in external libraries we use, so we can't change that part.)CC PR author: @kolodny