How to get InferModel to work with Relation model?

Is there a way to get the infer type for a relation model? eg: type User = InferModel<typeof users, "select">; type UserWithPosts = InferModel<typeof users, { posts: true }, "select" >;
1 Reply
mcgrealife
mcgrealife2y ago
@foreach I'm not sure if there is a specific helper to InferModel with types from relations (that looks like a clean syntax you propose though ^), but in case you are attempting to infer the type of a relation query, it's possible to wrap the query in a function and Infer the ReturnType of that https://discord.com/channels/1043890932593987624/1112458428070236229/1112519441561956352
Want results from more Discord servers?
Add your server