<BlockSwitcher>
<Block name="TypeScript">

```ts
const toDelete = await DataStore.query(Post, '1234567');
if (toDelete) {
  DataStore.delete(toDelete);
}
```

</Block>
<Block name="JavaScript">

```js
const toDelete = await DataStore.query(Post, '1234567');
DataStore.delete(toDelete);
```

</Block>
</BlockSwitcher>


You can also pass predicate operators to delete multiple items. For example, the following will delete all draft posts:

```js
await DataStore.delete(Post, (post) => post.status.eq(PostStatus.INACTIVE));
```

Additionally, you can perform a conditional delete. For instance, only delete **if** a post is in draft status by passing in an instance of a model:

<BlockSwitcher>
<Block name="TypeScript">

```ts
const toDelete = await DataStore.query(Post, '123');
if (toDelete) {
  DataStore.delete(toDelete, (post) => post.status.eq(PostStatus.INACTIVE));
}
``` 

</Block>
<Block name="JavaScript">

```js
const todelete = await DataStore.query(Post, '123');
DataStore.delete(todelete, (post) => post.status.eq(PostStatus.INACTIVE));
```

</Block>
</BlockSwitcher>


Also, to delete all items for a model you can use `Predicates.ALL`:

```js
await DataStore.delete(Post, Predicates.ALL);
```