numeric returns string when querying with Postgres

export const order = pgTable(
'orders', {
...
totalValue: numeric('total_value', { precision: 10, scale: 2 }),
...
})
export const order = pgTable(
'orders', {
...
totalValue: numeric('total_value', { precision: 10, scale: 2 }),
...
})
inspecting order.totalValue I get type
PgNumeric<{
tableName: "orders";
name: "total_value";
data: string;
driverParam: string;
notNull: false;
hasDefault: false;
}>
PgNumeric<{
tableName: "orders";
name: "total_value";
data: string;
driverParam: string;
notNull: false;
hasDefault: false;
}>
but when I do a query such as
await db
.insert(order)
.values({
...input,
})
.returning();
await db
.insert(order)
.values({
...input,
})
.returning();
The result is inferred as string | null for this column rather than number | null
1 Reply
rphlmr ⚡
rphlmr ⚡2y ago
GitHub
[BUG]: numeric types returning type string with postgres · Issue #5...
What version of drizzle-orm are you using? 0.25.3 What version of drizzle-kit are you using? 0.17.6 Describe the Bug export const order = pgTable( 'orders', { ... totalValue: numeric('t...
Want results from more Discord servers?
Add your server