We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined
drizzle-orm
^0.36.4
drizzle-kit
^0.28.1
"drizzle-zod": "^0.5.1",
I am using drizzle-zod to generate types, as I want to use them on the frontend/client... so I am running tsc on them and exporting them.
The issue i'm facing is that any non-string is being generated as a undefined type, you can see in my final code snippet.
Any suggestions?
Here is my tsc command i'm running tsc src/config/types.ts --declaration --emitDeclarationOnly --skipLibCheck --outDir dist/types/api
tsc src/config/types.ts --declaration --emitDeclarationOnly --skipLibCheck --outDir dist/types/api
Here is the schema
export const competitions = pgTable('competitions', { id: uuid('id').primaryKey().defaultRandom(), title: text('title').notNull(), description: text('description').notNull(), entryCost: integer('entry_cost').notNull(), prizePool: integer('prize_pool').notNull(), // Total points to distribute as rewards. ...
Here is the drizzle-zod schema
export type Competition = z.infer<typeof selectCompetitionSchema>;
Here is the generated tsc file
export declare const competitions: import("drizzle-orm/pg-core").PgTableWithColumns<{ name: "competitions"; schema: undefined; columns: { id: import("drizzle-orm/pg-core").PgColumn<{ name: "id"; tableName: "competitions"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; isPrimaryKey: true; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; title: import("drizzle-orm/pg-core").PgColumn<{ name: "title"; tableName: "competitions"; dataType: "string"; columnType: "PgText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; description: import("drizzle-orm/pg-core").PgColumn<{ name: "description"; tableName: "competitions"; dataType: "string"; columnType: "PgText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; entryCost: import("drizzle-orm/pg-core").PgColumn<{ name: "entry_cost"; tableName: "competitions"; dataType: "number"; columnType: "PgInteger"; data: number; driverParam: string | number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; prizePool: import("drizzle-orm/pg-core").PgColumn<{ name: "prize_pool"; tableName: "competitions"; dataType: "number"; columnType: "PgInteger"; data: number; driverParam: string | number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>;
As you can see here, all of the below types are coming back as undefined when they should be defined as numbers or strings
export declare const selectCompetitionSchema: z.ZodObject<{ id: z.ZodEnum<undefined>; title: z.ZodString; description: z.ZodString; entryCost: z.ZodEnum<undefined>; prizePool: z.ZodEnum<undefined>; ...
The text was updated successfully, but these errors were encountered:
This one was fixed in the latest drizzle-zod@0.6.0
drizzle-zod@0.6.0
Sorry, something went wrong.
Thanks for looking into it @AndriiSherman. It looks like a new issue now with no exported modules on the schema.types.internal
schema.types.internal
Previous to this version it was generating this here
I'm incurring on the same problem, drizzle-zod is 0.6.1...
createSelectSchema
createInsertSchema
createUpdateSchema
drizzle-zod
No branches or pull requests
Report hasn't been filed before.
What version of
drizzle-orm
are you using?^0.36.4
What version of
drizzle-kit
are you using?^0.28.1
Other packages
"drizzle-zod": "^0.5.1",
Describe the Bug
I am using drizzle-zod to generate types, as I want to use them on the frontend/client... so I am running tsc on them and exporting them.
The issue i'm facing is that any non-string is being generated as a
undefined
type, you can see in my final code snippet.Any suggestions?
Here is my tsc command i'm running
tsc src/config/types.ts --declaration --emitDeclarationOnly --skipLibCheck --outDir dist/types/api
Here is the schema
Here is the drizzle-zod schema
Here is the generated tsc file
As you can see here, all of the below types are coming back as
undefined
when they should be defined as numbers or stringsThe text was updated successfully, but these errors were encountered: