Search code examples
typescriptvue.jswindow

Error message: "Property 'EyeDropper' does not exist on type 'Window & typeof globalThis'."


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?


Solution

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

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