0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

fix(types): Deno.readDirSync's type returns an IteratorObject (#27805)

This commit is contained in:
Kenta Moriuchi 2025-01-25 01:25:55 +09:00 committed by GitHub
parent e475749935
commit 6880608452
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -3124,7 +3124,7 @@ declare namespace Deno {
* @tags allow-read
* @category File System
*/
export function readDirSync(path: string | URL): Iterable<DirEntry>;
export function readDirSync(path: string | URL): IteratorObject<DirEntry>;
/** Copies the contents and permissions of one file to another specified path,
* by default creating a new file if needed, else overwriting. Fails if target

View file

@ -25,6 +25,14 @@ Deno.test({ permissions: { read: true } }, function readDirSyncSuccess() {
assertSameContent(files);
});
Deno.test(
{ permissions: { read: true } },
function readDirSyncResultHasIteratorHelperMethods() {
const iterator = Deno.readDirSync("tests/testdata");
assertEquals(typeof iterator.map, "function");
},
);
Deno.test({ permissions: { read: true } }, function readDirSyncWithUrl() {
const files = [
...Deno.readDirSync(pathToAbsoluteFileUrl("tests/testdata")),