Skip to content

Should ClipboardItemData allow non-Promises? #1360

Open

Description

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

Activity

  1. cpplearner commented on Aug 6, 2022

    @cpplearner

    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.

  2. saschanaz commented on Aug 18, 2022

    @saschanaz
    Contributor

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

  3. saschanaz commented on Aug 18, 2022

    @saschanaz
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions