Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 17d21e9

Browse files
fix: FormData::entries(), FormData::[Symbol.iterator]() (#175)
* fix: `FormData::entries()`, `FormData::[Symbol.iterator]()` The types for `FormData::entries()`, `FormData::[Symbol.iterator]()` are marked as arrays of IterableIterators, which doesn't seem right. This PR removes the array notation, and adds tests for the both of them. * rename typechecks.yml -> checks.yml * add a changeset * pass tests
1 parent f1c3c40 commit 17d21e9

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

.changeset/mean-deers-drop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/workers-types": patch
3+
---
4+
5+
fix: FormData::entries(), FormData::[Symbol.iterator]()

.github/workflows/typechecks.yml .github/workflows/checks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests, Linter & Typecheck
1+
name: Checks
22

33
on: pull_request
44

overrides/http.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ declare class FormData {
99
set(name: string, value: string): void;
1010
set(name: string, value: Blob, filename?: string): void;
1111

12-
entries(): IterableIterator<[key: string, value: File | string][]>;
13-
[Symbol.iterator](): IterableIterator<[key: string, value: File | string][]>;
12+
entries(): IterableIterator<[key: string, value: File | string]>;
13+
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
1414

1515
forEach<This = unknown>(
1616
callback: (

tests/http.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const formData = new FormData();
2+
3+
const data: { [key: string]: string | File } = {};
4+
for (const [key, value] of formData.entries()) {
5+
// data[key] = value; // TODO: this should be uncommented
6+
}
7+
8+
for (const [key, value] of formData) {
9+
// data[key] = value; // TODO: this should be uncommented
10+
}
11+
12+
export {};

0 commit comments

Comments
 (0)