Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fs.promises.readFile('/foo', 'utf8')currently returnsPromise<string | Buffer>in TypeScript, forcing callers to cast before using string methods.Add encoding-sensitive overloads to both exported
FsPromisesApiinterfaces and share that signature with the concrete class. Text encodings inferPromise<string>; omitted encoding and memfs's'buffer'encoding inferPromise<Buffer>. Dynamic strings/options retain the union. Emitted JavaScript is unchanged.Add regression tests for encoding strings/objects, flags and binary results. Before the fix, these fail with six TS2322 assignment errors.
Fixes #702.
Validated locally on macOS arm64, Node 26.9.0 / Yarn 4.12.0:
yarn build,yarn typecheck,yarn prettier:check: passed.yarn test: 100 suites passed; 1,619 tests passed, 18 skipped; 14 snapshots passed.git diff --check: passed.FsPromises.ts— duplicate imports at line 7 and twoFunctiontype bans at line 21. Baseline and patched lint results are identical; no new lint failures.Scope is promise API
readFileinference;FileHandle.readFileand other method overloads are separate work. No dependency changes. The full upstream OS/Node CI matrix has not been run locally.AI assistance was used for investigation, implementation, testing and agent code review.