How drizzle handle nulls and undefineds ?

I'm running this query, but some values in where clause are undefined, how do i make it optional ?

Error: UNDEFINED_VALUE: Undefined values are not allowed

query:
 async list(companyId: number, lineClassId: number | undefined): Promise<Line[]> {
    const lines = await this.dbContext.dbset
      .select()
      .from(lineModel)
      .where(
        and(eq(lineModel.companyId, companyId), eq(lineModel.status, 'ativo'), eq(lineModel.lineClass, lineClassId)),
      );

    return lines.map((line) => new Line(line.id, line.lineNumber, line.visa, line.companyId));
  }
Was this page helpful?