Object literal may only specify known properties, and isActive does not exist in type

Some columns are not allowed on update. What am I doing wrong? Schema:
export const prices = pgTable('prices', {
id: varchar('id')
.primaryKey()
.$defaultFn(() => createId()),
price: integer('price').notNull(),
currency: varchar('currency').notNull(),
createdAt: timestamp('created_at').notNull().defaultNow(),
updatedAt: timestamp('updated_at').notNull().defaultNow(),
isActive: boolean('is_active').notNull().default(true),
});
export const prices = pgTable('prices', {
id: varchar('id')
.primaryKey()
.$defaultFn(() => createId()),
price: integer('price').notNull(),
currency: varchar('currency').notNull(),
createdAt: timestamp('created_at').notNull().defaultNow(),
updatedAt: timestamp('updated_at').notNull().defaultNow(),
isActive: boolean('is_active').notNull().default(true),
});
Code:
const markPricesAsInactive = async (priceIds: string[]) => {
await db
.update(t.prices)
.set({ isActive: false })
.where(inArray(t.prices.id, priceIds));
};
const markPricesAsInactive = async (priceIds: string[]) => {
await db
.update(t.prices)
.set({ isActive: false })
.where(inArray(t.prices.id, priceIds));
};
ts error:
Object literal may only specify known properties, and 'isActive' does not exist in type '{ price?: number | SQL<unknown>; currency?: string | SQL<unknown>; }'.
Object literal may only specify known properties, and 'isActive' does not exist in type '{ price?: number | SQL<unknown>; currency?: string | SQL<unknown>; }'.
No description
No description
No description
2 Replies
ihernandez
ihernandez4d ago
I have the same case, Did you find any solution?,
TOSL
TOSL4d ago
Type definition is probably not in sync with your schema try restarting typescript language server.

Did you find this page helpful?