Mismatch between docs and TS typings for Neon BatchResponse?

I'm currently in the process of switching my db provider to Neon (using the HTTP driver), and so I'm switching from using .transaction() to .batch(). I understand that they don't have entirely the same behavior, and for my use cases this is fine. However, I've run into a disconnect between the docs at https://orm.drizzle.team/docs/batch-api and the Typescript typings for .batch() in the drizzle-orm/neon-http flavor of Drizzle. The docs indicate that for code of the form const batchResponse: BatchResponse = await db.batch([...]);, the type BatchResponse is essentially:
[
{id: number;}[],
NeonHttpQueryResult,
<result of 1st query>,
<result of 2nd query>,
...
]
[
{id: number;}[],
NeonHttpQueryResult,
<result of 1st query>,
<result of 2nd query>,
...
]
However, the Typescript type is:
export type BatchResponse<T extends BatchItem[] | readonly BatchItem[]> = {
[K in keyof T]: T[K]['_']['result'];
};
export type BatchResponse<T extends BatchItem[] | readonly BatchItem[]> = {
[K in keyof T]: T[K]['_']['result'];
};
... which is basically the same thing but without the first 2 elements from the docs. Am I reading things right? If so, which one is correct?
Drizzle ORM - Batch
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?