Weird type error when searching by Index
I get this error when trying to filter by an index, i created it in my schema too.
Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)
I ahve attached image of the query.


14 Replies
never type?
How can the parameter be never type though?
Yup there is never type in typescript bro
It's kind of special thing
hmm i dont get it though, i created the index and ffollowed the docs, got no clue why it's giving me that linter error
Try giving
ctx
a type annotation with MutaitonCtx
from _generated/server
? (https://labs.convex.dev/auth/advanced#writing-additional-data-during-authentication)
TS needs the type annotation to know about all the tables defined in your schema (not just the ones defined in the auth schema)Advanced: Details - Convex Auth
Authentication library for your Convex backend
Do you know what is never type?
I assume it means it never returns something?
@🐐GoatGuy🐐 yeah see Sarah's comment, there's no way that this callback function can know about all your other tables, it only knows about those that come with Convex Auth unless you use
MutationCtx
explicitly
When you write normal mutations etc. you use the mutation()
wrapper imported from ../convex/_generated/server
which imports from your schema. But the convexAuth()
function doens't know about your schema, it's imported from the Convex Auth library.Right. But there are some special cases.
We can't console.log(result)
Stil have the same issue, ant
MutationCtx
doesn't work, can someone help me with that
Can you share a screenshot with type errors? MutationCtx missing the type either means it's not there, convex dev wasn't run, or there's some other error(s) throwing it off
I thought of the same thing and ran something on my running dev, and it looks like that the db for that function is warepped in " ctx: GenericMutationCtx<AnyDataModel>" which is empty,
I solved it by using adding a second query, and running the ct.runQuery, no errors there
plus: just a small tip, the args already pass down exsistingUserId, I don't know if that would help in your case!


Interesting, wonder why that method isn't generic