I am working with a function that has its return type determined by the arguments provided.
const example = (flag: boolean): typeof flag extends true ? "yes" : "no" => {
if (flag === true) {
return "yes"
} else {
return "no"
}
}
Why am I getting the error message
Type '"yes"' is not assignable to type '"no"'.ts(2322)
when I try to return "yes"
?
This issue is occurring in Typescript version 4.8.4.