interface c {
state?: {b: string}
}
const x: c = { state: {b: 'c'}}
console.log(x.state.b)
The code snippet above shows an interface called c with an optional property called state.
Although the property b of the state object is accessed in the code, it results in an error saying Object is possibly 'undefined'. How can this issue be correctly addressed?