Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add workaround

Manav Rathi0195a9b494c9
diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.ts
index 749c94f491..c86232fd64 100644
--- a/desktop/src/main/stream.ts
+++ b/desktop/src/main/stream.ts
@@ -142,6 +142,7 @@ const handleReadZip = async (zipPath: string, entryName: string) => {
// https://github.com/antelle/node-stream-zip/blob/master/node_stream_zip.js
const modifiedMs = entry.time;
+ // @ts-expect-error [Note: Node and web stream type mismatch]
return new Response(webReadableStream, {
headers: {
// We don't know the exact type, but it doesn't really matter, just
@@ -168,9 +169,12 @@ const handleWrite = async (path: string, request: Request) => {
*
* @param readableStream A web
* [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
+ *
*/
-export const writeStream = (filePath: string, readableStream: ReadableStream) =>
- writeNodeStream(filePath, Readable.fromWeb(readableStream));
+export const writeStream = (
+ filePath: string,
+ readableStream: unknown /*ReadableStream*/, // @ts-expect-error [Note: Node and web stream type mismatch]
+) => writeNodeStream(filePath, Readable.fromWeb(readableStream));
const writeNodeStream = async (filePath: string, fileStream: Readable) => {
const writeable = createWriteStream(filePath);
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 79792aa1c0..ad36052dc0 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -48,6 +48,14 @@
// Adding this reference here tells TypeScript that DOM typings (in particular,
// window) should be introduced in the ambient scope.
//
+// [Note: Node and web stream type mismatch]
+//
+// Unfortunately, adding this reference causes the ReadableStream typings to
+// break since lib.dom.d.ts adds its own incompatible definitions of
+// ReadableStream to the global scope.
+//
+// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/68407
+
/// <reference lib="dom" />
import { contextBridge, ipcRenderer, webUtils } from "electron/renderer";