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

Commit

Permalink
Updated types for 2022-01-19 (#186)
Browse files Browse the repository at this point in the history
* Updated types for 2022-01-19

* Enable tests for `FormData::entries()`, `FormData::[Symbol.iterator]()`

We'd added the tests in #175, but they were commented out because the overrides weren't applied. This PR applies the overrides to `index.d.ts`, so we can enable those tests now.

Co-authored-by: autodecl-bot[bot] <91285878+autodecl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sunil Pai <spai@cloudflare.com>
  • Loading branch information
autodecl-bot[bot] and threepointone committed Jan 19, 2022
1 parent 17d21e9 commit c117b5a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .changeset/2022-01-19.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/workers-types": minor
---

Updated auto-generated types @ 2022-01-19
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ declare class FormData {
has(name: string): boolean;
set(name: string, value: string): void;
set(name: string, value: Blob, filename?: string): void;
entries(): IterableIterator<[key: string, value: File | string][]>;
entries(): IterableIterator<[key: string, value: File | string]>;
keys(): IterableIterator<string>;
values(): IterableIterator<File | string>;
forEach<This = unknown>(
Expand All @@ -616,7 +616,7 @@ declare class FormData {
) => void,
thisArg?: This
): void;
[Symbol.iterator](): IterableIterator<[key: string, value: File | string][]>;
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
}

declare class HTMLRewriter {
Expand Down Expand Up @@ -820,7 +820,7 @@ interface KVNamespace<K extends string = string> {
* @param value value to store. The type is inferred. The maximum size of a value is 25MB.
* @returns Returns a `Promise` that you should `await` on in order to verify a successful update.
* @example
* await NAMESPACE.put(key, value)
* await NAMESPACE.put(key, value);
*/
put(
key: K,
Expand Down
94 changes: 41 additions & 53 deletions src/workers.json
Original file line number Diff line number Diff line change
Expand Up @@ -4261,32 +4261,27 @@
"name": "IterableIterator",
"args": [
{
"name": "[]",
"args": [
"name": "()",
"params": [
{
"name": "()",
"params": [
{
"name": "key",
"type": {
"name": "key",
"type": {
"name": "string"
}
},
{
"name": "value",
"type": {
"name": "|",
"args": [
{
"name": "File"
},
{
"name": "string"
}
},
{
"name": "value",
"type": {
"name": "|",
"args": [
{
"name": "File"
},
{
"name": "string"
}
]
}
}
]
]
}
}
]
}
Expand Down Expand Up @@ -4405,32 +4400,27 @@
"name": "IterableIterator",
"args": [
{
"name": "[]",
"args": [
"name": "()",
"params": [
{
"name": "()",
"params": [
{
"name": "key",
"type": {
"name": "key",
"type": {
"name": "string"
}
},
{
"name": "value",
"type": {
"name": "|",
"args": [
{
"name": "File"
},
{
"name": "string"
}
},
{
"name": "value",
"type": {
"name": "|",
"args": [
{
"name": "File"
},
{
"name": "string"
}
]
}
}
]
]
}
}
]
}
Expand Down Expand Up @@ -5951,9 +5941,7 @@
],
"returns": "Returns a `Promise` that you should `await` on in order to verify a successful update.",
"examples": {
"typescript": [
"await NAMESPACE.put(key, value)"
]
"typescript": ["await NAMESPACE.put(key, value);"]
}
}
},
Expand Down Expand Up @@ -7830,13 +7818,13 @@
"name": "|",
"args": [
{
"name": "'lossy'"
"name": "\"lossy\""
},
{
"name": "'lossless'"
"name": "\"lossless\""
},
{
"name": "'off'"
"name": "\"off\""
}
],
"optional": true
Expand Down Expand Up @@ -11988,4 +11976,4 @@
},
"kind": "function"
}
}
}
4 changes: 2 additions & 2 deletions tests/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const formData = new FormData();

const data: { [key: string]: string | File } = {};
for (const [key, value] of formData.entries()) {
// data[key] = value; // TODO: this should be uncommented
data[key] = value; // TODO: this should be uncommented
}

for (const [key, value] of formData) {
// data[key] = value; // TODO: this should be uncommented
data[key] = value; // TODO: this should be uncommented
}

export {};

0 comments on commit c117b5a

Please sign in to comment.