Home > database >  Error message: "Property 'EyeDropper' does not exist on type 'Window & typeof gl
Error message: "Property 'EyeDropper' does not exist on type 'Window & typeof gl

Time:09-01

I want to use "window.EyeDropper" in a (vue2 ts) project. When I write this line of code:

console.log(window.EyeDropper);

My plugins Vetur throws an error message:Property 'EyeDropper' does not exist on type 'Window & typeof globalThis'.

How can I modify the code to make it correct?

CodePudding user response:

Create and/or add to src/globals.d.ts:

declare global {
  interface Window {
    EyeDropper?: any;
  }
}
  • Related