Skip to content

fix(sql): allow not() to accept SQL | undefined (and/or return type)#5529

Open
Goldyvaiiii wants to merge 1 commit intodrizzle-team:mainfrom
Goldyvaiiii:fix/not-accepts-undefined
Open

fix(sql): allow not() to accept SQL | undefined (and/or return type)#5529
Goldyvaiiii wants to merge 1 commit intodrizzle-team:mainfrom
Goldyvaiiii:fix/not-accepts-undefined

Conversation

@Goldyvaiiii
Copy link
Copy Markdown

What

Fixes #1818

The not() function previously only accepted SQLWrapper, causing a TypeScript
error when composing it with and() or or(), which both return SQL | undefined:

// ❌ Before — TypeScript error
not(and(ilike(users.name, '%asdf%')))

// ✅ After — works perfectly
not(and(ilike(users.name, '%asdf%')))

@Goldyvaiiii
Copy link
Copy Markdown
Author

Hi! I’ve submitted a fix for this.

Updated not() to support SQL | undefined, aligning it with and() and or(). This allows not(and(...)) and not(or(...)) without casting, and ensures not(undefined) returns undefined consistently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: not type doesn't work with and and or

1 participant