drizzle-team / drizzle-team/drizzle-orm
[BUG]: Partial Insert returning expected 0 arguments
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.30.10
### What version of `drizzle-kit` are you using?
0.21.4
### Describe the Bug
I have the following code snippet:
```ts
const recordId = await db
.insert(organizationsTable)
.values({ clerkId: 'whatever-id' })
.returning({ id: organizationsTable.id });
```
After an insert, I'm trying to return a value with [partial insert returning](https://orm.drizzle.team/docs/insert#insert-returning). However, TS is complaining that `returning` "Expected 0 arguments, but got 1.":

Removing the partial return and simply returning the whole thing does not complain at all and works as expected:
```ts
const recordId = await db
.insert(organizationsTable)
.values({ clerkId: 'whatever-id' })
.returning();
```
I initially thought it was a problem with VSCode so I tried to restart TS server, make sure that it matches the project's TS version and so on, but it also fails when I do the build step.
Navigating to source I can see that both function definitions exist:
```ts
returning(): PgInsertWithout, TDynamic, 'returning'>;
returning(fields: TSelectedFields): PgInsert...
```
### Expected behavior
It should allow me to pass an argument to select the fields I want to return.
### Environment & setup
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.