# TS2722: Cannot invoke an object which is possibly 'undefined'.

> A value that may be undefined is called, under strictNullChecks. Check it first, or call it with ?.().

## What it means

The callee's type includes `undefined` (for example an optional method or callback), so calling
it directly could fail at runtime.

## Example

```ts
function run(cb?: () => void) {
  cb();
}
export {};
```

## How to fix

- Check before calling: `if (cb) cb();`.
- Use optional call: `cb?.()`.
- Make the parameter or property required if it is always provided.

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