# TS2532: Object is possibly 'undefined'.

> An object that may be undefined is accessed or called. Check for undefined first, or use optional chaining.

## What it means

With `strictNullChecks`, a value whose type includes `undefined` can't be used as an object until
the `undefined` case is handled. This form is used when the expression has no simple name to
show; with a name, the message is `'x' is possibly 'undefined'`.

## Example

```ts
declare function find(): { name: string } | undefined;
export const n = find().name;
```

## How to fix

- Check first: `const r = find(); if (r) { r.name }`.
- Use optional chaining and a default: `find()?.name ?? ""`.

Source: https://ts-r.dev/errors/TS2532/
