drizzle-team / drizzle-team/drizzle-orm
[BUG]: Empty findFirst and findMany queries returns unknown types with strictNullChecks set to false
- 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.29.2
### What version of `drizzle-kit` are you using?
0.20.9
### Describe the Bug
In my schema, I have this:
```ts
export const table1 = pgTable('Table1', {
id: text('id')
.primaryKey()
.$defaultFn(() => sql`gen_random_uuid()::text`)
.notNull(),
someField: boolean('someField').default(false).notNull()
});
```
If I run this query: `const item = await db.query.table.findFirst();`, the type of `item` is `{ [x: string]: unknown; }`. If I add a condition to the find many (any where condition), I get the proper return type of `table1`.
### Expected behavior
`strictNullChecks` is set to false and doesn't break types.
### Environment & setup
[Reproduction repository](https://github.com/jakeleventhal/drizzle-type-error-repro/tree/master)
Contributor guide
Assessment
This issue has not been assessed yet.