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

```ts
type Awaitable<T> = T | PromiseLike<T>;
```

Defined in: [packages/common/src/Types.ts:356](https://github.com/evoluhq/evolu/blob/49ea8ca499566aba270f8cb601e7f49aa62320f8/packages/common/src/Types.ts#L356)

A value that can be awaited.

Use when a function may complete synchronously or asynchronously depending on
runtime conditions (e.g., cache hit vs network fetch).

### Sync and async completion

```ts

const cache = new Map([["cached", "from cache"]]);
const getData = (id: string): Awaitable<string> =>
  cache.get(id) ?? Promise.resolve(`fetched ${id}`);

const fetched = await getData("missing");
const result = getData("cached");
const cached = isPromiseLike(result) ? await result : result;

expect(fetched).toBe("fetched missing");
expect(cached).toBe("from cache");
```