Possible Null Relations in v1.0

I'm in the process of migrating to the beta, but I've run into an issue where the relations I include in my query are optional in the inferred type of the output. For example suppose I have these relations defined:

accounts: {
        user: r.one.users({
            from: r.accounts.userId,
            to: r.users.id,
        }),
    }


and I call:

const output = db.query.accounts.findMany({
  with: {
    user: true
  }
})


I would expect the type of output to be:
{
  ...accountFields,
  user: userFields
}[]

but instead it's inferred as
{
  ...accountFields,
  user: userFields | null
}[]


Is this an intentional change to the API?
Was this page helpful?