fs: `walkSync` returns a type without iterator helpers

Open Beginner friendly
#7,099 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
deno, typescript
Domain
tooling

Research direction

Start at the walkSync declaration and its generator implementation, then run the TypeScript reproduction from the issue. Confirm that the public return type exposes the iterator helper methods available at runtime, and verify that the example using map type-checks successfully.

Written by the indexing model from the issue text.

Description

bug fs

Describe the bug
walkSync returns IterableIterator<WalkEntry>, which doesn't implement iterator helper methods. However it's implemented as a generator function so it has them at the runtime.

Steps to Reproduce

const a = walkSync(".");
const b = a.map(v => v.name); // Property 'map' does not exist on type 'IterableIterator<WalkEntry>'.

Environment

  • OS: Windows 10
  • deno version: deno 2.7.11
  • std version: 1.0.23
Dominant language
TypeScript
Stars
3.6k
Forks
685
Avg merge
10d 11m
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from denoland/std

All issues in denoland/std

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.