Skip to content

Conversation

@edmundhung
Copy link
Member

Fixes #5934 - FormData.append() and FormData.set() were missing
overloads that accept `string | Blob`, causing TS2769 errors when
passing union types in strict mode.
@edmundhung edmundhung requested review from a team as code owners January 22, 2026 14:27
@edmundhung edmundhung marked this pull request as draft January 22, 2026 14:27
@github-actions
Copy link

The generated output of @cloudflare/workers-types has been changed by this PR. If this is intentional, run just generate-types to update the snapshot. Alternatively, you can download the full generated types:

Full Type Diff
diff -r types/generated-snapshot/latest/index.d.ts bazel-bin/types/definitions/latest/index.d.ts
1650a1651,1656
>   append(name: string, value: string | Blob): void;
>   /**
>    * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
>    *
>    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
>    */
1681a1688,1693
>   /**
>    * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
>    *
>    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
>    */
>   set(name: string, value: string | Blob): void;
diff -r types/generated-snapshot/latest/index.ts bazel-bin/types/definitions/latest/index.ts
1655a1656,1661
>   append(name: string, value: string | Blob): void;
>   /**
>    * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
>    *
>    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
>    */
1686a1693,1698
>   /**
>    * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
>    *
>    * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
>    */
>   set(name: string, value: string | Blob): void;

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 22, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 11.51%

Comparing edmundhung/fix-formdata-union-overloads (bf83ba3) with main (2752663)

Summary

❌ 2 regressed benchmarks
✅ 68 untouched benchmarks
⏩ 129 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
simpleStringBody[Response] 19.1 µs 21.6 µs -11.48%
Encode_ASCII_32[TextEncoder][0/0/32] 3 ms 3.4 ms -11.51%

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

Missing overloads in FormData type definition

1 participant