Schema Type Issue: Property 'user' is incompatible with index signature.

The schema does not accept any values for some reason. I'm using one file per table method and exporting all of its constants from index.ts file(sc attached). No idea what is the error here. Can someone help, I've already lost too much time.
No description
No description
No description
No description
2 Replies
snorlax
snorlaxOP15mo ago
Type 'typeof import("/home/niraj/Documents/codeforreal-lms/server/src/db/models/index")' is not assignable to type 'Record<string, never>'. Property 'user' is incompatible with index signature. Type 'MySqlTableWithColumns<{ name: "user"; schema: undefined; columns: { id: MySqlColumn<{ name: "id"; tableName: "user"; dataType: "number"; columnType: "MySqlInt"; data: number; driverParam: string | number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; ... 8 more ...; credentia...' is not assignable to type 'never'.ts(2322) Translation Type 'typeof import("/home/niraj/Documents/codeforreal-lms/server/src/db/models/index")' is not assignable to type 'Record<string, never>'. I was expecting a type matching Record<string, never>, but instead you passed typeof import("/home/niraj/Documents/codeforreal-lms/server/src/db/models/index"). Property 'user' is incompatible with index signature. Request a translation for #2530 Type 'MySqlTableWithColumns<{ name: "user"; schema: undefined; columns: { id: MySqlColumn<{ name: "id"; tableName: "user"; dataType: "number"; columnType: "MySqlInt"; data: number; driverParam: string | number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; ... 8 more ...; credentia...' is not assignable to type 'never'. I was expecting a type matching never, but instead you passed MySqlTableWithColumns<{ name: "user"; schema: undefined; columns: { id: MySqlColumn<{ name: "id"; tableName: "user"; dataType: "number"; columnType: "MySqlInt"; data: number; driverParam: string | number; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, object>; ... 8 more ...; credentia.... Complete error trace from tsc
snorlax
snorlaxOP15mo ago
Figured it out. I've to set my db mode to "planetscale" since I'm not using the actual foreign key constraints.
No description
Want results from more Discord servers?
Add your server