drizzle-orm
drizzle-orm copied to clipboard
[BUG]: Partial Insert returning expected 0 arguments
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:
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. 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:
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:
returning(): PgInsertWithout<PgInsertReturningAll<this, TDynamic>, TDynamic, 'returning'>;
returning<TSelectedFields extends SelectedFieldsFlat>(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