drizzle-team / drizzle-team/drizzle-orm

[BUG]: Parsing SQLite schemas returned from drizzle-zod does not output correct types

Open
#4,619 7 comments 13 reactions 0 assignees View on GitHub
bug drizzle/zod
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

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

1.0.0-beta.1-c0277c0

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

1.0.0-beta.1-c0277c0

### Other packages

drizzle-zod@0.8.2 importing from `zod/v4`
better-sqlite3@11.10.0

### Describe the Bug

It seems that zod schemas returned by `createInsertSchema` and `createSelectSchema` from `drizzle-zod` do not result in the correct types when parsing a value.

As an example, here's an SQLite table I've defined, and an insert schema I've created and have attempted to parse with:

```js
const links = sqliteTable('links', {
id: int().primaryKey({ autoIncrement: true }),
notes: text(),
});

const LinkInsertSchema = createInsertSchema(links);

const test = LinkInsertSchema.parse({
notes: 'test',
})
```

The resulting type of the `test` variable is `Record`, which is incorrect.

Image

Note that in another project on the same dependency versions, using `pgTable`, I can confirm that parsing a zod schema returned from drizzle-zod results in the correct types for the resulting output.

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.