Skip to content

Allow iterable File constructor fileBits - #64336

Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/change-file-constructor-parameter-type
Draft

Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/change-file-constructor-parameter-type

Conversation

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

File constructor declarations only accepted BlobPart[], rejecting valid iterable inputs such as generators even though the platform API accepts iterable file bits.

  • DOM declarations

    • Change File constructor fileBits to Iterable<BlobPart> in DOM and WebWorker libs.
    • Keep the DOM test fixture in sync.
  • Regression coverage

    • Add a compiler test for generator-backed fileBits under es2022,dom.
new File((function* () {
    yield "a";
})(), "name");

@typescript-automation typescript-automation Bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Sep 19, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 19, 2026
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Change type of File constructor parameter fileBits to Iterable<BlobPart> Allow iterable File constructor fileBits Sep 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's already not workable that we touch the generated files, but these are test fixtures that definitely should not be edited either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change type of File constructor parameter fileBits to Iterable<BlobPart>

3 participants