Currently, I am puzzled by the lack of functionality in some code that I am reviewing. The structure resembles this:
function getValidity(x: "v1"): boolean;
function getValidity(x: "v2"): { a: number; b: number };
function getValidity(x: any) {
if (x === 'v1') {
return true;
} else {
return { a: 1, b: 2 };
}
}
However, upon execution, I encounter the following error:
This overload signature is not compatible with its implementation signature.(2394)
Reviewing some examples, it seems like my implementation should work, but clearly there's something missing. Can you help me figure out what it is?