79322858

Date: 2025-01-02 05:45:59
Score: 1
Natty:
Report link
type AnyObject = {
    [key: string]: AnyObject | undefined;
}

const a = {} as AnyObject
console.log(a.b?.c) // This is fine
console.log(a.b.c)  // This gives a possibly undefined error

You can try it on the TS Playground here

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Girdhari Agarwal