drizzle-team / drizzle-team/drizzle-orm

[BUG]: column type `json` array is returning `unknown[]`

Open
#2,913 0 comments 4 reactions 0 assignees View on GitHub
bug bug/fixed-in-beta db/postgres has-pr priority qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### What version of `drizzle-orm` are you using?

0.33.0

### What version of `drizzle-kit` are you using?

0.24.0

### Describe the Bug

```JS
export const messages = pgTable('messages', {
id: uuid('id').defaultRandom().primaryKey(),
content: text('content'),
type: text('type', { enum: ['user', 'assistant', 'tool'] }),
dialogId: uuid('dialog_id').references(() => dialogs.id, { onDelete: 'cascade' }),
tool_calls: json('tool_calls').$type().array(),
tool_call_id: text('tool_call_id'),
});
```

![image](https://github.com/user-attachments/assets/eec881bd-fa2e-444d-b05c-7ec92be2bb75)

### Expected behavior

The return type of column type `json` shouldn't be of type `unknown`

### Environment & setup

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.