drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Enhancing type accuracy for logical operators
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
Currently in variables holding SQL query expressions with logical operators like `and()` or `or()` can be inferred as `SQL | undefined`, even when conditions are clearly present:
```ts
import { and, ilike } from 'drizzle-orm';
const whereCondition = and(ilike(table.column1, 'test'));
// whereCondition type
const whereCondition: SQL | undefined
```
The proposal is to refine the type inference system to accurately reflect the presence of conditions, ensuring that `undefined` is not considered when conditions are indeed specified.
Contributor guide
Research direction
The issue names the TypeScript helpers and(), or(), and ilike(), but provides no file or test path. Start by locating their definitions and existing type tests, then trace how a single supplied condition is inferred. Done means expressions with specified conditions no longer include undefined while empty or absent conditions retain appropriate typing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100