Getting the error
error TS2304: Cannot find name 'ClipboardItem'
when trying to create a ClipboardItem for navigator.clipboard.write().
const clipboardItemInput = new ClipboardItem({'image/png' : blobInput});
await navigator.clipboard.write([clipboardItemInput]);
I am using Angular 6. Do I need to add any dependencies, or is there any other method?
The Typescript version might not incorporate all the features. This is where we need to extend it by creating typings or extending the existing ones. To solve the issue, try to create a types.d.ts file (reference1) and put the following in it:
Then reference the file in your component code with:
Then feel free to use the Class.
Inspiration: reference2