erquhartE
Convex Community3y ago
2 replies
erquhart

Convex ID's accepted in string index equality comparators

This makes sense I guess since the ID is indeed a string, but this is becoming a regular "gotcha" as I'm walking through some internal migrations.

    const legacyItem = await db
      .query('items')
      .withIndex('byExternalId', (q) => q.eq('externalId', itemId))
      .unique()


In this example,
itemId
is a convex ID. The
externalId
field expects a string - I would love some sort of option to cause this to be a type error.
Was this page helpful?