# computedAsync Type documentation

## TypeScript declaration

### [computedAsync](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/utils/signal-utils.ts#L27-L45>)

**Kind:** constant

```
import { computedAsync } from '@siemens/element-ng/markdown';
```

Computed value, but async. This exists because the `resource()` API is not suitable. During loading, the value changes to `undefined`. The proposed solution of resource snapshots and a `withPreviousValue()` function that uses `resourceFromSnapshots()` isn't suitable either because it's experimental.

Returns: readonly signal

```
<T, R>(options: ComputedAsyncOptions<T, R>) => Signal<T> = ...
```

```
computedAsync<T, R>(options: ComputedAsyncOptions<T, R>): Signal<T>
```

Computed value, but async. This exists because the `resource()` API is not suitable. During loading, the value changes to `undefined`. The proposed solution of resource snapshots and a `withPreviousValue()` function that uses `resourceFromSnapshots()` isn't suitable either because it's experimental.

Returns: readonly signal

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [options](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/utils/signal-utils.ts#L27-L27>) | `ComputedAsyncOptions<T, R>` |  | • the options |

**Returns:** [Signal](<https://angular.dev/api/core/Signal>)`<T>`

### Types Documentation

### [ComputedAsyncOptions](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/utils/signal-utils.ts#L9-L16>)

**Kind:** interface

```
import type { ComputedAsyncOptions } from '@siemens/element-ng/markdown';
```

Options for `computedAsync()`

```
interface ComputedAsyncOptions<T, R>
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [computation](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/utils/signal-utils.ts#L13-L13>) | `(params: R) => Promise<T>` | Computation function. This is `untracked()`, params from the `params` function are passed |
| [initial](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/utils/signal-utils.ts#L15-L15>) | `T` | Initial value of the `computedAsync` signal. |
| [params](<https://github.com/siemens/element/blob/main/projects/element-ng/markdown/utils/signal-utils.ts#L11-L11>) | `() => R` | Params function, params will be passed to the `computation` function. This is tracked. |
