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

This commit is contained in:
Sam Hinshaw
2025-08-17 02:19:44 -07:00
committed by GitHub
parent d3d290ab8a
commit 515182a179
2 changed files with 7 additions and 1 deletions
@@ -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.')
}