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](https://cdn.answeroverflow.com/1158694981872128041/image.png)
![No description](https://cdn.answeroverflow.com/1158694982304137286/image.png)
![No description](https://cdn.answeroverflow.com/1158694982631297034/image.png)
![No description](https://cdn.answeroverflow.com/1158694982916513812/image.png)
2 Replies
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
Figured it out. I've to set my db mode to "planetscale" since I'm not using the actual foreign key constraints.
![No description](https://cdn.answeroverflow.com/1158721548727877805/image.png)