Nested "with" queries infer type "any"
The types for my queries with relations, are not inferred, and instead are always typed as "any".
So for example, what's mentioned in the docs...
const users = await db.query.users.findMany({
with: {
posts: {
with: {
comments: true,
},
},
},
});
"For any nested with queries Drizzle will infer types using Core Type API."
...this does not seem to happen for me. For none of my queries. So the example above, posts and comments would both be inferred as type "any".
I have properly defined and exported my schema, including tables and relations.
I have successfully generated and run migrations.
I am able to run my nested with queries and the relations are properly returned, so no issues there either.
Furthermore, I don't remember this not working when I first started my project, and I exported a couple of tables and relations from a single file.
Does anyone have an idea what might be going wrong?
https://orm.drizzle.team/docs/rqbDrizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
2 Replies