zCustomQuery and use of zid + Id<"tableName" returns type errors: is incompatible with index
anyone able to help with this?
using zCustomQuery causes issues when defining
zid("tableName")
in the validator.
fyi: using convex ents, but that doesn't appear related.
Argument of type '{ tableNameId: Id<"tableName">; }' is not assignable to parameter of type '{ [x: string]: undefined; tableNameId: string & { tableName: "tableName"; }; }'.
Property 'tableNameId' is incompatible with index signature.
Type 'Id<"tableName">' is not assignable to type 'undefined'.ts(2345)
(property) tableNameId: string & {
tableName: "tableName";
}
here is the zInternalQuery.
if i convert it from zCustomQuery
to customQuery
and use v("tableName")
everything works normally.
when running the query (e.g. client side), the expected id is type cast, e.g.
the error persists.3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
actually, i see the issue report on github, my bad 🙂
https://github.com/get-convex/convex-helpers/issues/708
GitHub
Getting types errors in v0.1.100 when calling a zCustomQuery with c...
TSC error: { userId: Id<"users">; } is not assignable to parameter of type { [x: string]: undefined; userId: string & { __tableName: "users"; }; } Reproduction: https:...
Fixed and shipped in the latest release - sorry about that!