Hello! I have the following code:
type ToBoolean<T> = T extends boolean ? boolean : T;
function f<T extends boolean>() {
const x: ToBoolean<T> = false;
return x;
}
TypeScript shows error over const x:
Type 'false' is not assignable to type 'ToBoolean<T>'.ts(2322)
const x: ToBoolean<T>
Can somebody explain why this does not compile?
Thank you!