GUD
TTCTheo's Typesafe Cult
•Created by GUD on 7/23/2024 in #questions
Override error in React tutorial on the add userId to the database step
Before adding the userId to the schema the line
presents no problems. Once I add userId to the schema it presents the expected error. Once I push the new schema to the db this error presents:
await db.insert(images).values({
await db.insert(images).values({
No overload matches this call.
Overload 1 of 2, '(value: { name: string | SQL<unknown> | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 more ... | undefined; }): PgInsertBase<...>', gave the following error.
Type 'string | null' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
Type 'null' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
Overload 2 of 2, '(values: { name: string | SQL<unknown> | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 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>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 more ... | undefined; }[]'.
No overload matches this call.
Overload 1 of 2, '(value: { name: string | SQL<unknown> | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 more ... | undefined; }): PgInsertBase<...>', gave the following error.
Type 'string | null' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
Type 'null' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
Overload 2 of 2, '(values: { name: string | SQL<unknown> | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 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>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 more ... | undefined; }[]'.
8 replies