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:
parent
e475749935
commit
6880608452
2 changed files with 9 additions and 1 deletions
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -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
|
||||
|
|
|
@ -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")),
|
||||
|
|
Loading…
Add table
Reference in a new issue