drizzle-team / drizzle-team/drizzle-orm
[BUG]: drizzle-zod with typing issues in monorepo from version 0.8.1
- 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?
0.44.2
### What version of `drizzle-kit` are you using?
0.31.1
### Other packages
drizzle-zod@0.8.2 / zod@3.25.51 / fastify-type-provider-zod@4.0.2
### Describe the Bug
The issue started occurring from version 0.8.1 onwards; it was working normally before that.
Database Schema:
```ts
import * as t from 'drizzle-orm/pg-core'
import { createSelectSchema } from 'drizzle-zod'
export const training = t.pgTable('trainings', {
id: t.integer().primaryKey().generatedAlwaysAsIdentity(),
})
export const trainingSchema = {
table: training,
select: createSelectSchema(training),
}
```
API Route:
```ts
import type { FastifyInstance } from 'fastify'
import type { ZodTypeProvider } from 'fastify-type-provider-zod'
import { trainingSchema } from '@repo/drizzle/schemas'
import z from 'zod'
export async function getTraining(app: FastifyInstance) {
app.withTypeProvider().get(
'/v1/training',
{
schema: {
response: {
200: z.object({
training: trainingSchema.select,
}),
},
},
},
async (request, reply) => {
return true
},
)
}
```
Error:
```ts
Type 'ZodObject<{ id: ZodInt; }, { out: {}; in: {}; }>' is missing the following properties from type 'ZodType': _type, _parse, _getType, _getOrReturnCtx, and 7 more.ts(2740)
types.d.ts(14, 5): The expected type comes from this index signature.
```
Contributor guide
Assessment
This issue has not been assessed yet.