Closed
Description
TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)
Code
interface Base {
key: string;
}
interface A extends Base {
}
interface B extends Base {
}
export function test(key: "aa"): A;
export function test(key: "bb1"): B;
export function test(key: "bb2"): B;
export function test(key: string): Base {
return { key: key };
}
export function bbTest(key: "bb1" | "bb2"): B {
return test(key);
}
playground url:
here
Expected behavior:
No compiler errors; type inference to understand that "return test(key)" returns a B type.
Actual behavior:
"return test(key)" doesn't compile because of an argument type error