From 9b643dfa87c6a13e52b803e29c5b7982b59662bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 19 Sep 2026 01:26:35 +0000 Subject: [PATCH 1/2] Initial plan From b3675cf05ef2ff32825160309e405abfcdf3e212 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 19 Sep 2026 01:38:48 +0000 Subject: [PATCH 2/2] Accept iterable File constructor bits Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> --- tsc/internal/bundled/libs/lib.dom.d.ts | 2 +- tsc/internal/bundled/libs/lib.webworker.d.ts | 2 +- .../fileConstructorIterableFileBits.symbols | 9 +++++++++ .../fileConstructorIterableFileBits.types | 17 +++++++++++++++++ tsc/testdata/fixtures/lib/dom.generated.d.ts | 2 +- .../compiler/fileConstructorIterableFileBits.ts | 7 +++++++ 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.symbols create mode 100644 tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.types create mode 100644 tsc/testdata/tests/cases/compiler/fileConstructorIterableFileBits.ts diff --git a/tsc/internal/bundled/libs/lib.dom.d.ts b/tsc/internal/bundled/libs/lib.dom.d.ts index 9e127c3f5a524..ac1c1a2cc6b91 100644 --- a/tsc/internal/bundled/libs/lib.dom.d.ts +++ b/tsc/internal/bundled/libs/lib.dom.d.ts @@ -14439,7 +14439,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; + new(fileBits: Iterable, fileName: string, options?: FilePropertyBag): File; }; /** diff --git a/tsc/internal/bundled/libs/lib.webworker.d.ts b/tsc/internal/bundled/libs/lib.webworker.d.ts index 45c6a6134821d..21c11b034b93d 100644 --- a/tsc/internal/bundled/libs/lib.webworker.d.ts +++ b/tsc/internal/bundled/libs/lib.webworker.d.ts @@ -4680,7 +4680,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; + new(fileBits: Iterable, fileName: string, options?: FilePropertyBag): File; }; /** diff --git a/tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.symbols b/tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.symbols new file mode 100644 index 0000000000000..0c68a2aa78245 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.symbols @@ -0,0 +1,9 @@ +//// [tests/cases/compiler/fileConstructorIterableFileBits.ts] //// + +=== fileConstructorIterableFileBits.ts === +new File((function* () { +>File : Symbol(File, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) + + yield "a"; +})(), "name"); + diff --git a/tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.types b/tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.types new file mode 100644 index 0000000000000..b6d0552b0bb8e --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/fileConstructorIterableFileBits.types @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/fileConstructorIterableFileBits.ts] //// + +=== fileConstructorIterableFileBits.ts === +new File((function* () { +>new File((function* () { yield "a";})(), "name") : File +>File : { new (fileBits: Iterable, fileName: string, options?: FilePropertyBag): File; prototype: File; } +>(function* () { yield "a";})() : Generator +>(function* () { yield "a";}) : () => Generator +>function* () { yield "a";} : () => Generator + + yield "a"; +>yield "a" : any +>"a" : "a" + +})(), "name"); +>"name" : "name" + diff --git a/tsc/testdata/fixtures/lib/dom.generated.d.ts b/tsc/testdata/fixtures/lib/dom.generated.d.ts index d667879250cf4..514d959aaed42 100644 --- a/tsc/testdata/fixtures/lib/dom.generated.d.ts +++ b/tsc/testdata/fixtures/lib/dom.generated.d.ts @@ -14423,7 +14423,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; + new(fileBits: Iterable, fileName: string, options?: FilePropertyBag): File; }; /** diff --git a/tsc/testdata/tests/cases/compiler/fileConstructorIterableFileBits.ts b/tsc/testdata/tests/cases/compiler/fileConstructorIterableFileBits.ts new file mode 100644 index 0000000000000..f1d6cef4f47d1 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/fileConstructorIterableFileBits.ts @@ -0,0 +1,7 @@ +// @target: es2022 +// @lib: es2022,dom +// @noEmit: true + +new File((function* () { + yield "a"; +})(), "name");