fix: Specify Generic for readFile ArrayBuffer (fix #2914) (#2915)

This commit is contained in:
Sam Hinshaw authored and GitHub committed 2025-08-17 17:19:44 +08:00
1 parent d3d290ab8a
commit 515182a179
2 files changed
+7 -1

No files matched your search

@@ -0,0 +1,6 @@
---
fs: patch
fs-js: patch
---
`readFile` now returns a more specific type `Promise<Uint8Array<ArrayBuffer>>` instead of the default `Promise<Uint8Array<ArrayBufferLike>`
+1 -1
View File
@@ -739,7 +739,7 @@ interface ReadFileOptions {
async function readFile(
path: string | URL,
options?: ReadFileOptions
): Promise<Uint8Array> {
): Promise<Uint8Array<ArrayBuffer>> {
if (path instanceof URL && path.protocol !== 'file:') {
throw new TypeError('Must be a file URL.')
}