drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: ignore undefined values in `AND` array in the query builder

Open
#5,141 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Feature hasn't been suggested before.

- [x] I have verified this feature I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

It would be nice to be able to specify some optional conditions in the query builder when using `AND: [...]` by returning undefined for some array elements, when a particular condition is not needed (at runtime). Right now, it throws a type error, because `AND` doesn't support undefined values. It should just ignore those and filter them out, like the `and()` function does.

Contributor guide

Open the contributing guide

Research direction

Start by locating the query-builder implementation for AND arrays and the existing and() handling referenced in the issue. Check how undefined values are typed and processed, then find the related query-builder tests. Done means optional AND conditions can be returned as undefined without a type error and are ignored at runtime, while existing conditions retain their behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.