type Input = 'a' | 'b';
type ResultOf<T extends Input> = T extends 'a' ? 'A' : 'B';
function foo<T extends Input>(input: T): ResultOf<T> {
return input === 'a' ? 'A' : 'B';
}
The code above errors with error TS2322: Type '"A" | "B"' is not assignable to type 'ResultOf<T>'.
, but why?