Closed
Description
The following example is valid in the current compiler but not in the typescript based compiler:
interface A {
type: "a";
}
interface B {
type: "b";
}
interface Types {
a: A;
b: B;
}
export function exhaustiveSwitch<T extends keyof Types>(type: T): boolean {
switch (type) {
case "a":
return true;
case "b":
return true;
}
}
resulting in the error:
src/exhaustive-generic-switch.ts:14:67 - error TS2366: Function lacks ending return statement and return type does not include 'undefined'.