Open Artemoire opened 1 year ago
Fyi, this also spreads to astro:db
, as mentioned in withastro/astro#10462.
also struggling with this issue
Pretty sure this issue isn't driver specific. There's currently not much priority towards the batch API, but we'll certainly address this at some point.
What version of
drizzle-orm
are you using?0.28.6
What version of
drizzle-kit
are you using?0.19.13
Describe the Bug
When using a batch query which maps data into queries, I have to use typescript kung fu to make sure batch API does not complain.
Example use-case:
Expected behavior
I would expect the batch response generic definition to allow using dynamic arrays instead of only Readonly tuples.
I think the issue is with how BatchResponse is defined: https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/libsql/driver.ts#L34
TQuery extends Readonly<[U, ...U[]]>
allows the batch parameter to only be a const tuple. I'm not an expert but a simple solution would be allowing TQuery to either extend a tuple or an array like so:TQuery extends Readonly<[U, ...U[]]> | U[]
Another potential solution would be to allow sending nested array queries, but that would incur runtime costs
Environment & setup
In my local vscode typescript server