In both the src/service/items.ts and src/service/outfits.ts, a critical error is thrown on object creation (POST) where .values(body) has a typing mismatch. This is being thrown because we instruct Zod in the insertItemSchema variable to be a string and optional. Then in the function call, we strictly set authorUsername apart of the body to a hardcoded string "rak3rman". These types do not match.
[x] Investigate why npm run format is not throwing any errors or warnings on this issue
[x] Fix the issue, resolve types by modifying the Zod schema
The problem description is as follows:
TS2769: No overload matches this call.
Overload 1 of 2, '(value: { type: number | SQL<unknown> | Placeholder<string, any>; authorUsername: string | SQL<unknown> | Placeholder<string, any>; id?: number | SQL<unknown> | Placeholder<...> | undefined; ... 5 more ...; quality?: number | ... 3 more ... | undefined; }): SQLiteInsert<...>', gave the following error.
Argument of type '{ type: itemTypeEnum; name?: string | null | undefined; brand?: string | null | undefined; photo?: string | null | undefined; rating?: number | null | undefined; quality?: number | ... 1 more ... | undefined; authorUsername?: string | undefined; }' is not assignable to parameter of type '{ type: number | SQL<unknown> | Placeholder<string, any>; authorUsername: string | SQL<unknown> | Placeholder<string, any>; id?: number | SQL<unknown> | Placeholder<...> | undefined; ... 5 more ...; quality?: number | ... 3 more ... | undefined; }'.
Types of property 'authorUsername' are incompatible.
Type 'string | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
Type 'undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
Overload 2 of 2, '(values: { type: number | SQL<unknown> | Placeholder<string, any>; authorUsername: string | SQL<unknown> | Placeholder<string, any>; id?: number | SQL<unknown> | Placeholder<...> | undefined; ... 5 more ...; quality?: number | ... 3 more ... | undefined; }[]): SQLiteInsert<...>', gave the following error.
Argument of type '{ type: itemTypeEnum; name?: string | null | undefined; brand?: string | null | undefined; photo?: string | null | undefined; rating?: number | null | undefined; quality?: number | ... 1 more ... | undefined; authorUsername?: string | undefined; }' is not assignable to parameter of type '{ type: number | SQL<unknown> | Placeholder<string, any>; authorUsername: string | SQL<unknown> | Placeholder<string, any>; id?: number | SQL<unknown> | Placeholder<...> | undefined; ... 5 more ...; quality?: number | ... 3 more ... | undefined; }[]'.
Type '{ type: itemTypeEnum; name?: string | null | undefined; brand?: string | null | undefined; photo?: string | null | undefined; rating?: number | null | undefined; quality?: number | ... 1 more ... | undefined; authorUsername?: string | undefined; }' is missing the following properties from type '{ type: number | SQL<unknown> | Placeholder<string, any>; authorUsername: string | SQL<unknown> | Placeholder<string, any>; id?: number | SQL<unknown> | Placeholder<...> | undefined; ... 5 more ...; quality?: number | ... 3 more ... | undefined; }[]': length, pop, push, concat, and 35 more.
In both the
src/service/items.ts
andsrc/service/outfits.ts
, a critical error is thrown on object creation (POST) where.values(body)
has a typing mismatch. This is being thrown because we instruct Zod in theinsertItemSchema
variable to be a string and optional. Then in the function call, we strictly setauthorUsername
apart of the body to a hardcoded string "rak3rman". These types do not match.npm run format
is not throwing any errors or warnings on this issueThe problem description is as follows: