node:fs: accept the readdir recursive/withFileTypes values node accepts - #39330
Open
robobun wants to merge 3 commits into
Open
node:fs: accept the readdir recursive/withFileTypes values node accepts#39330robobun wants to merge 3 commits into
robobun wants to merge 3 commits into
Claude / Claude Code Review
completed
Aug 16, 2026 in 14m 46s
Code review found 1 potential issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/js/node/fs.promises.ts:311-315 |
promises.readdir spread drops inherited encoding/withFileTypes when coercing recursive |
Annotations
Check warning on line 315 in src/js/node/fs.promises.ts
claude / Claude Code Review
promises.readdir spread drops inherited encoding/withFileTypes when coercing recursive
nit: `{ ...options }` copies own-enumerable properties only, so an inherited `withFileTypes`/`encoding` (e.g. `const opts = Object.create({ withFileTypes: true }); opts.recursive = 1`) is dropped before the native parser sees it — Node returns `Dirent[]` here, this returns `string[]`. `options = { __proto__: options, recursive: !!recursive }` preserves the prototype chain without mutating the caller's object (the native parser already walks the prototype via `val.get`).
Loading