Skip to content

Missing Definition On Navigator.ClipBoard #43821

Closed
@mango906

Description

@mango906

lib Update Request

Configuration Check

My compilation target is ES2015 and my lib is the default.

Missing / Incorrect Definition

there is no type ClipboardItem constructor and read, write method on Navigator.Clipboard

It has already been mentioned on a similar issue before.

#26728

Chrome supports write method from v66 and also ClipboardItem but now current version is v90. I think it is stable enough.

How about adding at least write method and ClipboardItem without constructor like this

mango906@587267c

Sample Code

// sampleBlob blob
const blob = '';

navigator.clipboard.write([
    new ClipboardItem({
     'image/png': blob,
    }),
]);
error TS2304: Cannot find name 'ClipboardItem'
error TS2339: Property 'write' does not exist on type 'Clipboard'

playground

Documentation Link

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions