TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

Should ClipboardItemData allow non-Promises?

Open DanielRosenwasser opened this issue 2 years ago • 3 comments

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: https://github.com/microsoft/TypeScript/issues/46116

DanielRosenwasser avatar Jul 14 '22 21:07 DanielRosenwasser

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.

cpplearner avatar Aug 06 '22 17:08 cpplearner

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

saschanaz avatar Aug 18 '22 21:08 saschanaz

https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/fc5fe1a880c5cb5750169f4b21dbb597fb052c9a/baselines/dom.generated.d.ts#L3644-L3647

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

saschanaz avatar Aug 18 '22 21:08 saschanaz