Skip to content

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

Open
Goldyvaiiii wants to merge 2 commits 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 2 commits 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.

@Goldyvaiiii
Copy link
Copy Markdown
Author

Hi @AndriiSherman

This is a small, safe fix for #1818 aligning not() with and()/or() (supports SQL | undefined, no breaking changes).

Could you please approve the workflows so checks can run? Should be ready to merge after that.

Thanks!

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