I'm struggling to understand the issue with this simple example
interface List {
"A": false,
"B": false,
}
// The function is missing a return statement and its return type does not include 'undefined'.ts(2366)
// I wonder why?
function bar<T extends keyof List>(letter: T): List[T] {
switch (letter) {
case "A":
return false
case "B":
return false
}
}
Which value would make letter
result in an undefined return from my function?