belter
belter9h ago

authTables Error

Hello, well I'm trying to use authTables in a clean schema (clean project) but throw me an error... im using convex as a package (turborepo) I'm using: "@auth/core": "^0.40.0", "@convex-dev/auth": "^0.0.89", "convex": "^1.27.1" Error: Argument of type '{ users: TableDefinition<VObject<{ name: string; email: string; phone: string; image: string; emailVerificationTime: number; phoneVerificationTime: number; }, { name: VString<string, "required">; email: VString<...>; phone: VString<...>; image: VString<...>; emailVerificationTime: VFloat64<...>; phoneVerificationTim...' is not assignable to parameter of type 'GenericSchema'. Property 'authSessions' is incompatible with index signature. Type 'TableDefinition<VObject<{ userId: Id<"users">; expirationTime: number; }, { userId: VId<Id<"users">, "required">; expirationTime: VFloat64<number, "required">; }, "required", "userId" | "expirationTime">, { ...; }, {}, {}>' is not assignable to type 'TableDefinition<Validator<any, any, any>, {}, {}, {}>'. Types have separate declarations of a private property 'indexes'.ts(2345) Can anyone help me or guideme to fix this problem? thanks!
No description
No description
14 Replies
Sara
Sara9h ago
typescript things if you want to remove the table and use your own, try:
const { users , ...restAuthTables} = authTables
export default defineSchema({
...restAuthTables,
users:defineTable({

// your data
})
});
const { users , ...restAuthTables} = authTables
export default defineSchema({
...restAuthTables,
users:defineTable({

// your data
})
});
if you want to add some details to the users table, try:
export default defineSchema({
...authTables,
users:defineTable({
...authTables.users.validator.fields
// the rest of your data
})
});

export default defineSchema({
...authTables,
users:defineTable({
...authTables.users.validator.fields
// the rest of your data
})
});

belter
belterOP9h ago
But then the error doesn't matter?
Sara
Sara9h ago
can you copy the error message from the second screenshot? sorry I didn't read the second one
belter
belterOP9h ago
Argument of type '{ users: TableDefinition<VObject<{ name?: string | undefined; email?: string | undefined; phone?: string | undefined; image?: string | undefined; emailVerificationTime?: number | undefined; phoneVerificationTime?: number | undefined; isAnonymous?: boolean | undefined; }, { ...; }, "required", "name" | ... 5 more ......' is not assignable to parameter of type 'GenericSchema'.
Property 'users' is incompatible with index signature.
Type 'TableDefinition<VObject<{ name?: string | undefined; email?: string | undefined; phone?: string | undefined; image?: string | undefined; emailVerificationTime?: number | undefined; phoneVerificationTime?: number | undefined; isAnonymous?: boolean | undefined; }, { ...; }, "required", "name" | ... 5 more ... | "isAno...' is not assignable to type 'TableDefinition<Validator<any, any, any>, {}, {}, {}>'.
Types have separate declarations of a private property 'indexes'.ts(2345)
Argument of type '{ users: TableDefinition<VObject<{ name?: string | undefined; email?: string | undefined; phone?: string | undefined; image?: string | undefined; emailVerificationTime?: number | undefined; phoneVerificationTime?: number | undefined; isAnonymous?: boolean | undefined; }, { ...; }, "required", "name" | ... 5 more ......' is not assignable to parameter of type 'GenericSchema'.
Property 'users' is incompatible with index signature.
Type 'TableDefinition<VObject<{ name?: string | undefined; email?: string | undefined; phone?: string | undefined; image?: string | undefined; emailVerificationTime?: number | undefined; phoneVerificationTime?: number | undefined; isAnonymous?: boolean | undefined; }, { ...; }, "required", "name" | ... 5 more ... | "isAno...' is not assignable to type 'TableDefinition<Validator<any, any, any>, {}, {}, {}>'.
Types have separate declarations of a private property 'indexes'.ts(2345)
Sara
Sara9h ago
If I had to guess, you should run pnpm dlx convex dev to update types in your terminal is this just for adding the authTables declaration?
belter
belterOP9h ago
yeap
belter
belterOP9h ago
if i remove, the error gone
No description
Sara
Sara9h ago
what happens if you restart the ts server?
belter
belterOP9h ago
same
belter
belterOP9h ago
this is what happend when i rewrite ...authTables
No description
Sara
Sara9h ago
I think your IDE might be rigged can you do command+p + shift and restart the ts server again?
belter
belterOP9h ago
same idk what its happening
Sara
Sara8h ago
do you have some sort of extention downloaded on VScode? cause that error is a bit too harsh we can see that its being updated just fine Its a bit too late for me, so I'm out for tonight
belter
belterOP8h ago
wasa thing with ts and my packages I solved it thanks to you telling me it would be a typescript problem. "typescript things" I have to extend my tsconfig.json from my workspace
{
"extends": "@workspace/typescript-config/base.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler", //this are missing in my workspace
}
}
{
"extends": "@workspace/typescript-config/base.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler", //this are missing in my workspace
}
}
I don't know how well I did this, but it works

Did you find this page helpful?