From 9b183da810de3738c5bcb0e0a5d0c5162fad0835 Mon Sep 17 00:00:00 2001 From: jjohnson Date: Thu, 10 Aug 2023 14:20:18 -0500 Subject: [PATCH] Fix type errors --- packages/miniflare/src/workers/core/entry.worker.ts | 2 +- packages/miniflare/test/plugins/d1/shared.ts | 3 --- packages/miniflare/test/plugins/d1/suite.ts | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/miniflare/src/workers/core/entry.worker.ts b/packages/miniflare/src/workers/core/entry.worker.ts index efa78fc3a..47789c261 100644 --- a/packages/miniflare/src/workers/core/entry.worker.ts +++ b/packages/miniflare/src/workers/core/entry.worker.ts @@ -159,7 +159,7 @@ async function handleQueue( const flattened = await request.json(); const messages = unflatten(flattened, structuredSerializableRevivers); const queueResponse = await service.queue(queueName, messages); - (queueResponse as QueueResponse & { time: number }).time = + (queueResponse as FetcherQueueResult & { time: number }).time = Date.now() - startTime; return Response.json(queueResponse); } diff --git a/packages/miniflare/test/plugins/d1/shared.ts b/packages/miniflare/test/plugins/d1/shared.ts index 599b8bed1..873643f57 100644 --- a/packages/miniflare/test/plugins/d1/shared.ts +++ b/packages/miniflare/test/plugins/d1/shared.ts @@ -54,9 +54,6 @@ export class TestD1Database implements D1Database { return this[kSend]("/batch", statements); } - // @ts-expect-error this function should return a `Promise`, - // not a `Promise>`, `@cloudflare/workers-types` is wrong here - // TODO(now): fix in `@cloudflare/workers-types` async exec(query: string): Promise { return this[kSend]("/exec", query); } diff --git a/packages/miniflare/test/plugins/d1/suite.ts b/packages/miniflare/test/plugins/d1/suite.ts index a8e7acb83..950c98351 100644 --- a/packages/miniflare/test/plugins/d1/suite.ts +++ b/packages/miniflare/test/plugins/d1/suite.ts @@ -192,7 +192,7 @@ export default (binding: string, WORKER_PATH: string) => { const select = await db.prepare(`SELECT * FROM ${tableColours}`); let result: ColourRow | null = await select.first(); t.deepEqual(result, { id: 1, name: "red", rgb: 0xff0000 }); - let id = await select.first("id"); + let id: number | null = await select.first("id"); t.is(id, 1); // Check with multiple statements (should only match on first statement)