From 515182a179d4439079b2b7f6927555ba5ab0b035 Mon Sep 17 00:00:00 2001 From: Sam Hinshaw Date: Sun, 17 Aug 2025 02:19:44 -0700 Subject: [PATCH] fix: Specify Generic for readFile ArrayBuffer (fix #2914) (#2915) --- .changes/fs-write-uint8array-arraybuffer.md | 6 ++++++ plugins/fs/guest-js/index.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/fs-write-uint8array-arraybuffer.md diff --git a/.changes/fs-write-uint8array-arraybuffer.md b/.changes/fs-write-uint8array-arraybuffer.md new file mode 100644 index 000000000..37b53d913 --- /dev/null +++ b/.changes/fs-write-uint8array-arraybuffer.md @@ -0,0 +1,6 @@ +--- +fs: patch +fs-js: patch +--- + +`readFile` now returns a more specific type `Promise>` instead of the default `Promise` diff --git a/plugins/fs/guest-js/index.ts b/plugins/fs/guest-js/index.ts index d4858b0e8..572cc1e85 100644 --- a/plugins/fs/guest-js/index.ts +++ b/plugins/fs/guest-js/index.ts @@ -739,7 +739,7 @@ interface ReadFileOptions { async function readFile( path: string | URL, options?: ReadFileOptions -): Promise { +): Promise> { if (path instanceof URL && path.protocol !== 'file:') { throw new TypeError('Must be a file URL.') }