TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
Should ClipboardItemData allow non-Promises?
https://github.com/microsoft/TypeScript/blob/a21024dbe7e79dc018e4193f27ecb66e0465b638/lib/lib.dom.d.ts#L3555
This implies that the options argument only allows Promise
s of Blob
s and string
s, and the spec says so too; however, some browsers allow Blob
s and string
s to be used directly, and MDN seems to document that behavior too.
Related: https://github.com/microsoft/TypeScript/issues/46116
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.
It seems this is regressed at some point after #1102.
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?