Strange Doc type/inference: "[x: string]: any;, _id: Id<string>;"
Hi, we've been running into this strange problem a few different places in our repo by now and can't quite seem to figure out what's going on.
Basically, sometimes, the type returned by a
Doc<TableName>
returns this strange thing:
We're in an expo/Next monorepo, and seems to work fine when inside our backend package (where Convex is), but not when we are in our native/web packages (even though we just import Doc
from the generated files)1 Reply
I don't have a ton of ideas here, but I'd suggest running TS from the command line (like
npx tsc -p .
from the root of your Next project, or whatever project has a tsconfig.json
and is giving you the type issues). Sometimes there's a TS error buried somewhere that manifests as these generic types, and shows up a little easier when you run from the command line and can see all the issues at once.
I know VSCode will pick the tsconfig.json
closest to your source files when it shows types / type errors in the editor, which can be different from how your project is actually compiled, which might be why the types seem happier in your backend package but not in the main repo (your editor is picking the closer tsconfig.json
)