drizzle-team / drizzle-team/drizzle-orm

[BUG]: Incorrect type inference with multidimensional array field PostgreSQL

Open
#1,028 5 comments 0 reactions 1 assignee Claimed by @dankochetov View on GitHub
bug bug/fixed-in-beta db/postgres has-pr priority
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.28.2

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

0.19.12

### Describe the Bug

I have a PostgreSQL table with shape roughly like this:

```ts
export type HyperLinkRecord = { id: string; name: string; table: ModuleIdEnum };

export const traits = pgTable('traits', {
mergeFrom: jsonb('merge_from').$type().array(2).array().notNull(),
});
```

Try update drizzle-orm@0.27.2 to drizzle-orm@0.28.2.

and the type of mergeFrom turn to `unknown[][]`
The schema returned correct type with drizzle-orm@0.27.2 though

### Expected behavior

type of `mergeFrom` properties should be `HyperLinkRecord[][]`

### Environment & setup

full [package.json](https://github.com/Senbonzakura1234/sophie-dex/blob/6ff9dafcf3732258fc6bf743480b7ab574ec2cfd/package.json) of my project

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.