Skip to content

fix(types): declare FormData prototype methods - #6056

Merged
mcollina merged 1 commit into
nodejs:mainfrom
RlxChap2:fix/formdata-prototype-types
Oct 22, 2026
Merged

mcollina merged 1 commit into
nodejs:mainfrom
RlxChap2:fix/formdata-prototype-types

Conversation

@RlxChap2

Copy link
Copy Markdown
Contributor

This relates to...

Refs: nodejs/node#58481

Rationale

iteratorMixin installs these functions on FormData.prototype, but
the declarations describe instance properties. This prevents valid
subclass overrides and super calls in TypeScript.

Changes

Features

N/A

Bug Fixes

  • Declare forEach, keys, values, entries, and Symbol.iterator as methods.
  • Add type tests covering all five methods and an arrow-function override.

Breaking Changes and Deprecations

No runtime changes or deprecations. Parameter and return types are unchanged.

Status

tsd, lint, and test:fetch passed. test:typescript encounters the
Windows wildcard issue in #5928; explicit-file compilation passed.
The full npm test suite was not run.

AI assisted with the patch and tests.

Match the methods installed on FormData.prototype by iteratorMixin.
This allows subclasses to override them and call super.

Cover all five methods and an arrow-function override with type tests.

Refs: nodejs/node#58481
Assisted-by: a coding assistant
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 91.55%. Comparing base (f4e4e45) to head (6542c4e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6056      +/-   ##
==========================================
- Coverage   91.57%   91.55%   -0.02%     
==========================================
  Files         113      113              
  Lines       43938    43938              
==========================================
- Hits        40235    40228       -7     
- Misses       3703     3710       +7     

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina
mcollina merged commit 8bac8df into nodejs:main Oct 22, 2026
38 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants