Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows passing iterable to Blob and File #1536

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3073,7 +3073,7 @@ interface Blob {

declare var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
new(blobParts?: Iterable<BlobPart>, options?: BlobPropertyBag): Blob;
Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot do this as the base lib needs to be ES5 compatible. This kind of thing is done in dom.iterable but the constructor can't be extended in the current design. We are blocked here.

};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent) */
Expand Down Expand Up @@ -8209,7 +8209,7 @@ interface File extends Blob {

declare var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
new(fileBits: Iterable<BlobPart>, fileName: string, options?: FilePropertyBag): File;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions baselines/serviceworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ interface Blob {

declare var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
new(blobParts?: Iterable<BlobPart>, options?: BlobPropertyBag): Blob;
};

interface Body {
Expand Down Expand Up @@ -2479,7 +2479,7 @@ interface File extends Blob {

declare var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
new(fileBits: Iterable<BlobPart>, fileName: string, options?: FilePropertyBag): File;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions baselines/sharedworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ interface Blob {

declare var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
new(blobParts?: Iterable<BlobPart>, options?: BlobPropertyBag): Blob;
};

interface Body {
Expand Down Expand Up @@ -2343,7 +2343,7 @@ interface File extends Blob {

declare var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
new(fileBits: Iterable<BlobPart>, fileName: string, options?: FilePropertyBag): File;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ interface Blob {

declare var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
new(blobParts?: Iterable<BlobPart>, options?: BlobPropertyBag): Blob;
};

interface Body {
Expand Down Expand Up @@ -2680,7 +2680,7 @@ interface File extends Blob {

declare var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
new(fileBits: Iterable<BlobPart>, fileName: string, options?: FilePropertyBag): File;
};

/**
Expand Down
26 changes: 26 additions & 0 deletions inputfiles/overridingTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,18 @@
]
},
"Blob": {
"constructor": {
"signature": {
"0": {
"param": [
{
"name": "blobParts",
"overrideType": "Iterable<BlobPart>"
}
]
}
}
},
"methods": {
"method": {
"stream": {
Expand All @@ -2434,6 +2446,20 @@
}
}
},
"File": {
"constructor": {
"signature": {
"0": {
"param": [
{
"name": "fileBits",
"overrideType": "Iterable<BlobPart>"
}
]
}
}
}
},
"ReadableStream": {
"typeParameters": [
{
Expand Down