From 2577cfe2f10e523a63a7efb3a8824acce7b9c750 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 15 Apr 2024 21:43:38 +0530 Subject: [PATCH] Replace cast with @ts-expect-error --- web/apps/photos/src/utils/native-stream.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/apps/photos/src/utils/native-stream.ts b/web/apps/photos/src/utils/native-stream.ts index 809aa9e209..65db237b30 100644 --- a/web/apps/photos/src/utils/native-stream.ts +++ b/web/apps/photos/src/utils/native-stream.ts @@ -21,16 +21,15 @@ export const writeStream = async (path: string, stream: ReadableStream) => { // only within our desktop (Electron) app, Chromium, don't support 'full' // duplex mode (i.e. streaming both the request and the response). // https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests - // - // In another twist, the TypeScript libdom.d.ts does not include the - // "duplex" parameter, so we need to cast to get TypeScript to let this code - // through. e.g. see https://github.com/node-fetch/node-fetch/issues/1769 const req = new Request(`stream://write${path}`, { // GET can't have a body method: "POST", body: stream, + // @ts-expect-error TypeScript's libdom.d.ts does not include the + // "duplex" parameter, e.g. see + // https://github.com/node-fetch/node-fetch/issues/1769. duplex: "half", - } as unknown as RequestInit); + }); const res = await fetch(req); if (!res.ok) throw new Error(