Repository navigation
fix: accept fs typed by @types/node 26 in the file system types - #700
Conversation
@types/node 26 changed fs.statSync and fs.readFileSync: the bigint: boolean statSync overload now uses throwIfNoEntry?: true, and readFileSync dropped the overload taking any options at once. Node's fs no longer fit ReadFileSync, StatSync and LStatSync, so passing graceful-fs or fs to CachedInputFileSystem failed to type-check. Keep only the overloads @types/node 24 and 26 agree on, and have SyncAsyncFileSystemDecorator hand each kind of options to its own readFileSync overload instead of forwarding them as one value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #700 +/- ##
==========================================
+ Coverage 98.46% 98.99% +0.52%
==========================================
Files 52 52
Lines 10908 10932 +24
==========================================
+ Hits 10741 10822 +81
+ Misses 167 110 -57
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The two failing checks, The prebuilt Generated by Claude Code |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
🦋 Changeset detectedLatest commit: 5414625 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Node 26's statSync/lstatSync still return defined stats for
{ bigint: boolean } without throwIfNoEntry, so the overload stays
assignable from fs and keeps callers' results free of undefined.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
fs.rmSync is missing on Node.js 12, which the test matrix still runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
lts/* now resolves to Node.js 26, where the @codspeed/core native add-on fails to load, so both benchmark jobs exit before measuring anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh (cherry picked from commit bd5a445)
|
The fix for the benchmark failure now exists: #701 pins the benchmark job to Node.js 24.22.0. I've ported it here as commit 62b9e33 so this PR's benchmarks can go green. Once #701 merges, that commit has no effect. Generated by Claude Code |
TypeScript picks the first matching overload, so { bigint: true } and
{ bigint: false } widened to IStats | IBigIntStats while the boolean
overload came first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
atimeNs only exists since Node.js 12.10, and the test matrix runs Node.js 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
The last main baseline ran on Node.js 24.21.0; measuring pull requests on 24.22.0 shows runtime allocation changes as regressions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh
Merging this PR will degrade performance by 14.16%2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes |
|
No code change can make this check green. A maintainer needs to acknowledge these results on CodSpeed, or Generated by Claude Code |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## enhanced-resolve@5.26.1 ### Patch Changes - Accept `fs` typed by `@types/node` 26 in the file system types. (by [@alexander-akait](https://github.com/alexander-akait) in [#700](#700)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…3100) * fix: drop the NodeEnvironmentPlugin suppression for @types/node 26 fs Needs the enhanced-resolve release with webpack/enhanced-resolve#700. Its fs types then accept graceful-fs typed by @types/node 26, and webpack's StatSync and LStatSync drop the same { bigint: boolean } overload, so the CachedInputFileSystem is assignable without a suppression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh * fix: drop the enhanced-resolve suppressions for @types/node 26 fs Bump enhanced-resolve to 5.26.1, whose file system types accept fs typed by @types/node 26, so CachedInputFileSystem(fs) type-checks without @ts-expect-error in NodeEnvironmentPlugin and the benchmark worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh * fix: keep the boolean bigint stat overload in the fs types Match enhanced-resolve 5.26.1: { bigint: boolean } without throwIfNoEntry returns defined stats, ordered after the literal true/false overloads so those keep their exact result types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HArJAXZagrHVVNLZZk9soh --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
@types/node26 changed two sync methods:fs.statSync: the{ bigint: boolean }overload now takesthrowIfNoEntry?: true(24 declaredthrowIfNoEntry?: falsewhile returningStats | BigIntStats, thoughfalsecan returnundefined).fs.readFileSync: dropped the overload that accepted every kind of options at once (string | object | null | undefined).Node's
fstyped by 26 therefore no longer fitsReadFileSync,StatSyncandLStatSynchere.new CachedInputFileSystem(fs)fails to type-check for projects on@types/node26, and webpack carries a@ts-expect-erroron that line inNodeEnvironmentPlugin.This PR:
StatSync/LStatSync: keeps only the overloads 24 and 26 agree on. The{ bigint: true | false }forms now saythrowIfNoEntry?: true, as 26 does. The{ bigint: boolean }form is dropped, so such a call goes to the general overload, which includesundefined, as Node can whenthrowIfNoEntryisfalse.ReadFileSync: its last overload takes a required options object, matching what both versions provide.SyncAsyncFileSystemDecorator: it forwardedreadFile/readFileSyncoptions tofs.readFileSyncas a single value of all kinds. It now handsnull/undefined, an encoding string and an options object each to their own overload through a smallreadFileSyncWithhelper. Each branch makes the same call as before, so behavior is unchanged.Both directions type-check:
npm run lint:typesandlint:types-testpass here, against@types/node24.@types/node26),new CachedInputFileSystem(fs, 60000)is accepted. Once webpack's ownStatSyncdrops the same{ bigint: boolean }overload, the result is assignable to webpack'sInputFileSystemand the suppression can go. That webpack change is ready and waits for this release.Test
test/SyncAsyncFileSystemDecorator.test.jsreads a fixture throughreadFileSyncandreadFilewith no options,null, an encoding string and an options object, and checks the buffer or string for each.Testing
npm run lint:code,lint:types,lint:types-test,fmt:checkandlint:spellcheckpass.Generated by Claude Code
Summary by CodeRabbit
null.@types/node26.