One to One with Where Clause

   return await this.db?.query.systemUser.findFirst({
      where(fields, operators) {
        return operators.and(operators.eq(fields.id, userId));
      },
      with: {
        systemDevice: {
          where: and(eq(this.table.systemDevice.id, systemDeviceId),isNull(this.table.systemDevice.deleted_at)),
          columns: {
            user_agent: true,
            user_ip: true,
          },
        },
        systemRole: {
          columns: {
            name: true,
          },
        },
      },
     ....


it is work normal but just error of typescript of where clause in relation (systemDevice, this one to one).
how to fix? i know for one to one relation, we can not use where clause. but it is work haha, so i have no touch it. but i want to fix the type error?
Screenshot_2025-01-07_at_9.47.22_at_night.png
Was this page helpful?