I would like to use optional chaining operator in typescript, but I get the error Property 'dog' does not exist on type '{ name: string; cat: Record<string, string>; }'.
. Totally make sense the error complain from typescript but I am wondering if anyway for me to walk around?
playground
const adventurer: {name: string;cat:Record<string, string>} = {
name: 'Alice',
cat: {
name: 'Dinah'
}
};
const dogName = adventurer?.dog;
console.log(dogName);