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

Should ClipboardItemData allow non-Promises? #1360

Open
DanielRosenwasser opened this issue Jul 14, 2022 · 3 comments
Open

Should ClipboardItemData allow non-Promises? #1360

DanielRosenwasser opened this issue Jul 14, 2022 · 3 comments

Comments

@DanielRosenwasser
Copy link
Member

https://github.com/microsoft/TypeScript/blob/a21024dbe7e79dc018e4193f27ecb66e0465b638/lib/lib.dom.d.ts#L3555

This implies that the options argument only allows Promises of Blobs and strings, and the spec says so too; however, some browsers allow Blobs and strings to be used directly, and MDN seems to document that behavior too.

Related: microsoft/TypeScript#46116

@cpplearner
Copy link

cpplearner commented Aug 6, 2022

I think https://webidl.spec.whatwg.org/#es-promise means that conversion from ECMAScript value V to an IDL Promise<T> value effectively performs new Promise((resolve, reject) => resolve(V)).

So yes, non-Promises should be accepted.

@saschanaz
Copy link
Contributor

It seems this is regressed at some point after #1102.

@saschanaz
Copy link
Contributor

declare var ClipboardItem: {
prototype: ClipboardItem;
new(items: Record<string, string | Blob | PromiseLike<string | Blob>>, options?: ClipboardItemOptions): ClipboardItem;
};

Well actually it's there, so maybe it's just that TS should import the latest bits?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants