-
Notifications
You must be signed in to change notification settings - Fork 440
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
WebIDL parameter Promise type not converted when in a nested type, e.g. ClipboardItemData #999
Comments
I see there's some code to handle this already: TypeScript-DOM-lib-generator/src/emitter.ts Line 749 in a75338e
It works great for the Payment Request API:
But not for ClipboardItemData because it's in the value position of a record type that is itself a parameter to a function. The recursion in |
@github-actions close |
Closing because @saschanaz is one of the code-owners of this repository. |
WebIDL has an implicit conversion mechanism for an ECMAScript value
V
into an IDLPromise<T>
type. This means that any function defined in WebIDL that accepts aPromise<T>
implicitly acceptsT|Promise<T>
.However, the generated TypeScript typings for a WebIDL function that accepts a
Promise<T>
argument only have the typePromise<T>
, and not the non-Promise
T
type. The generated typings should haveT|Promise<T>
.e.g. in https://w3c.github.io/clipboard-apis/#clipboard-interface, the
ClipboardItem
constructor takesClipboardItemData
as the values in theitems
record. The generated typings for that type should bestring|Blobl|Promise<string|Blob>
but instead it's justPromise<string|Blob>
.See wffurr@9c8bc4b for an example.
The text was updated successfully, but these errors were encountered: