drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Prepared Statement: expected placeholder typings

Open
#4,684 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

After creating a prepared statement, it doesn't seem to get the types for the `.execute()` part.

Not sure if possible or how hard, so the suggestion would be to add a generic to prepare:

```ts
const prepared = db.query.table.findMany({
where: (t, f) => f.eq(t.id, sql.placeholder('id'))
}).prepare<{ id: number }>()
```

This way should be more feasible to pull those types and have intellisense on `.execute()`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.