Issue when inserting

export const plan = pgTable("plans",{
    id: uuid("id").primaryKey().notNull(),
    userId: text("user_id").notNull().references(() => user.id),
    budget: integer("budget").notNull(),
    city: text("city").notNull(),
    startDate:date("start_date").notNull(),
    endDate:date("end_date").notNull(),
    groupSize: integer("group_size").notNull(),
    rating: integer("rating")
})

        const planData = await db.insert(plan)
            .values({
            userId: "d",
            budget: 222,
            city: "WOW",
            startDate: new Date(),
            endDate: new Date(),
            groupSize: 1
            })
            .returning()


I get the error on userId

No overload matches this call.
  Overload 2 of 2, '(values: { userId: string | SQL<unknown> | Placeholder<string, any>; id: string | SQL<unknown> | Placeholder<string, any>; budget: number | SQL<unknown> | Placeholder<string, any>; ... 4 more ...; rating?: number | ... 3 more ... | undefined; }[]): PgInsertBase<...>', gave the following error.
    Object literal may only specify known properties, and 'userId' does not exist in type '{ userId: string | SQL<unknown> | Placeholder<string, any>; id: string | SQL<unknown> | Placeholder<string, any>; budget: number | SQL<unknown> | Placeholder<string, any>; ... 4 more ...; rating?: number | ... 3 more ... | undefined; }[]'.ts(2769)
Was this page helpful?