It's the second part for my question that was asked here. I've been helped with the solution for my previous problem, but once I added the interface for the alphabet
object, Typescript stopped detecting that I provided the incorrect value.
interface ICharMap { lower: number upper: number } const alphabet: {[key: string]: ICharMap} = { 'a': {lower: 97, upper: 65}, 'b': {lower: 98, upper: 66} } type Char = keyof typeof alphabet; function printSome(char: Char){ console.log(char) } printSome('c') \\ Typescript does not detect that the incorrect value is passed.