TS2532: Object is possibly undefined - in CI
You used a value that can be undefined without checking it first.
What this error means
Type-checking fails with TS2532, commonly on optional properties or indexed array access under noUncheckedIndexedAccess.
tsc
src/list.ts(7,3): error TS2532: Object is possibly 'undefined'.Common causes
How to fix it
Guard or default the value
- Check for undefined, use optional chaining, or supply a default with ??
ts
const first = items[0]
if (first) use(first)Narrow with optional chaining
- Chain member access so undefined short-circuits safely
ts
const name = user?.profile?.name ?? "anon"How to prevent it
- Handle optional and indexed values explicitly; noUncheckedIndexedAccess surfaces these before runtime.
Related guides
TS2531: Object is possibly null - in CIFix "error TS2531: Object is possibly 'null'" when tsc runs in CI under strictNullChecks - guard the value be…
TS18048: Value is possibly undefined - in CIFix "error TS18048: 'x' is possibly 'undefined'" when tsc runs in CI - narrow an optional or indexed value be…
TS2533: Object is possibly null or undefined - in CIFix "error TS2533: Object is possibly 'null' or 'undefined'" when tsc runs in CI - guard a value typed T | nu…