[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Result](https://evolu.dev/docs/api-reference/common/Result) › getOrNull

```ts
function getOrNull<T, E>(result: Result<T, E>): T | null;
```

Defined in: [packages/common/src/Result.ts:376](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Result.ts#L376)

Extracts the value from a [Result](https://evolu.dev/docs/api-reference/common/Result/type-aliases/Result) if it is an `Ok`, or returns `null`
if it is an `Err`.

**Intended usage:**

- When you need to convert a `Result` to a nullable value for APIs that expect
  `T | null`.
- When the error is not important and you just want the value or nothing.

### Example

```ts
// For APIs that expect T | null
const user = getOrNull(findUser(id));
```