You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export type Scout = typeof scoutTable.$inferSelect; // return type when queried
export type NewScout = typeof scoutTable.$inferInsert; // insert type
`
when I created the table above and using vercel-postgres the typescript compiler got the dateOfbirth type correct which is string, but in runtime when I query the data from table above I got Date type instead of string that breaks React rendering.
Expected behavior
Expected to have string type in runtime instead of type date
Environment & setup
here is the DB client below
`
import { drizzle } from "drizzle-orm/vercel-postgres";
import { sql } from "@vercel/postgres";
const db = drizzle(sql);
export default db;
`
using nextjs "14.1.3" and vercel postgres database.
The text was updated successfully, but these errors were encountered:
exporttypeScout=typeofscoutTable.$inferSelect;// return type when queriedexporttypeNewScout=typeofscoutTable.$inferInsert;// insert type
Can you explain this?
If you are exporting type then you can try scoutTable as type
But the date type from the $inferSelect & $inferInsert is of type "string" not "Date" which is what i expected, but when i log the value in runtime i got "Date" type instead of "string"
What version of
drizzle-orm
are you using?0.30.1
What version of
drizzle-kit
are you using?0.30.1
Describe the Bug
`
import { pgTable, date, uuid, boolean, varchar } from "drizzle-orm/pg-core";
import { subdistrictTable, villageTable } from "./regions";
import { userTable } from "./users";
export const scoutTable = pgTable("scouts", {
id: uuid("id").defaultRandom().primaryKey().notNull(),
fullname: varchar("fullname", {
length: 100,
}).notNull(),
dateOfBirth: date("date_of_birth").notNull(),
});
export type Scout = typeof scoutTable.$inferSelect; // return type when queried
export type NewScout = typeof scoutTable.$inferInsert; // insert type
`
when I created the table above and using vercel-postgres the typescript compiler got the dateOfbirth type correct which is string, but in runtime when I query the data from table above I got Date type instead of string that breaks React rendering.
Expected behavior
Expected to have string type in runtime instead of type date
Environment & setup
here is the DB client below
`
import { drizzle } from "drizzle-orm/vercel-postgres";
import { sql } from "@vercel/postgres";
const db = drizzle(sql);
export default db;
`
using nextjs "14.1.3" and vercel postgres database.
The text was updated successfully, but these errors were encountered: