Query to include parent with child infers types as `never`
Hello,
In my schema, I have a self-referential foreign key set up:
I'm trying to select the parent with the child like this:
However, the inferred type of
accounts
is:
3 Replies
Use the following instead
import {alias} from 'drizzle-orm/pg-core'
@johncmacy
aliasedTable for the relational api onlyThanks @TOSL, that did the trick. I think the docs could be improved in this area - here's where I got my attempted solution above from, and I can't find anything about your solution.
Drizzle ORM - Joins
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
You're welcome. Yeah that is very misleading. Thankfully that's a easy fix. I'll make a PR.