Whose Error Is It?

TypeScript printed this

error TS2532: Object is possibly 'undefined'.
What it meansUnder strict null checks, TypeScript sees that this value's type includes undefined, so accessing it directly might fail at runtime.
The first thing to checkCheck for undefined first with an if statement, use optional chaining like obj?.prop, or provide a default with ??; avoid ! unless you are sure.

More from TypeScript

All 75 errors

Whose Error Is It? · Status Menu · Back to the bar