Tomathy
Tomathy
Explore posts from servers
DTDrizzle Team
Created by Tomathy on 9/2/2024 in #help
No overload matches this call
I'm sorry that I'm already the 4th person with this sort of post, but the other posts didn't really help me out. I'm having an issue where it's sayig a certain attribute isn't in the type generated, but I don't see why not, and when I run the code it does work
await db.insert(clients).values({
name: faker.person.fullName(),
nif: faker.number.int({min: 100000000, max: 999999999}).toString(),
password: faker.internet.password(),
email: faker.internet.email(),
activity: client_activity[faker.number.int({min: 0, max: 2})],
obs: faker.helpers.arrayElement(['', faker.lorem.sentence()]),
services: faker.number.int({min: 1, max: services.length})
})
await db.insert(clients).values({
name: faker.person.fullName(),
nif: faker.number.int({min: 100000000, max: 999999999}).toString(),
password: faker.internet.password(),
email: faker.internet.email(),
activity: client_activity[faker.number.int({min: 0, max: 2})],
obs: faker.helpers.arrayElement(['', faker.lorem.sentence()]),
services: faker.number.int({min: 1, max: services.length})
})
Here's the schema:
//Clients table
export const clients = pgTable("clients",{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }).notNull(),
nif: char("nif", { length: 9}).unique().notNull(),
password: bytea("password").unique().notNull(),
email: varchar("email", { length: 256}).unique(),
rf_taxrep: rfEnum("rf_taxrep"),
activity: activityEnum("activity").notNull(),
obs: text("obs"),
services: serial("services").references(() => service.id, {onDelete: "cascade"}),
})
//Clients table
export const clients = pgTable("clients",{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }).notNull(),
nif: char("nif", { length: 9}).unique().notNull(),
password: bytea("password").unique().notNull(),
email: varchar("email", { length: 256}).unique(),
rf_taxrep: rfEnum("rf_taxrep"),
activity: activityEnum("activity").notNull(),
obs: text("obs"),
services: serial("services").references(() => service.id, {onDelete: "cascade"}),
})
Here's the error: No overload matches this call. Overload 2 of 2, '(values: { name: string | SQL<unknown> | Placeholder<string, any>; nif: string | SQL<unknown> | Placeholder<string, any>; password: SQL<unknown> | Buffer | Placeholder<...>; ... 5 more ...; services?: number | ... 2 more ... | undefined; }[]): PgInsertBase<...>', gave the following error. Object literal may only specify known properties, and 'name' does not exist in type '{ name: string | SQL<unknown> | Placeholder<string, any>; nif: string | SQL<unknown> | Placeholder<string, any>; password: SQL<unknown> | Buffer | Placeholder<...>; ... 5 more ...; services?: number | ... 2 more ... | undefined; }[]'.
12 replies