---
url: >-
  https://canary.warp-drive.io/api/@warp-drive/core/reactive/functions/checkout.md
description: >-
  Resolves with an editable copy of an immutable `ReactiveResource` so its
  fields can be changed locally.
---

# &#x20;checkout()

```ts
function checkout<T>(resource: unknown): Promise<T & ReactiveResource>;
```

Defined in: [warp-drive-packages/core/src/reactive/-private/record.ts:761](https://github.com/warp-drive-data/warp-drive/blob/48dc0d277b98008082669dadc6a52e5c5682ef8e/warp-drive-packages/core/src/reactive/-private/record.ts#L761)

Checkout an immutable resource for editing.

[ReactiveResources](../types/ReactiveResource.md) are not editable by default. This method
creates an editable copy of the resource.

This returns a promise which resolves with the editable
version of the resource.

```ts
import { checkout } from '@warp-drive/core/reactive';

const immutable = store.peekRecord('user', '1');
const editable = await checkout(immutable);
```

Edits to editable resources will be automatically committed if a new
payload from the cache matches their existing value.

## Type Parameters

### T

`T`

## Parameters

### resource

`unknown`

## Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`T` & [`ReactiveResource`](../types/ReactiveResource.md)>

a promise that resolves to the editable resource

## Throws

if the resource is already editable or if resource is an embedded object
