TypeErr: BatchItem<sqlite>[] not assignable to readonly [BatchItem<sqlite>, ...BatchItem<sqlite>[]]

Hi, I'm trying to use drizzle/d1 (cloudflare worker) for batch. But I'm getting type error.
export const insert_logs_from_batch = async (
  batch: MessageBatch<logSchema>,
  env: Bindings
): Promise<InsertBatchLogsResponse> => {
  const db = drizzle(env.DB);

  const refine_batch = batch.messages.map((log) => {
    return db.insert(logs).values({
      ...log.body
    }) as BatchItem<"sqlite">; // <--casting as BatchItem cause original type doesn't match as batchItem 
  });

  try {
    const res = await db.batch([...refine_batch]); // --> Getting the type error here. it works on runtime

    return { success: true, data: null };
  } catch (err) {
    return { success: false, error: err };
  }
};
Was this page helpful?