2

Visual Studio has most of the typescript definitions built into it for the window object because most all of them work. However, "window.chrome" is not defined. How can I add this to the existing typescript definitions so I can get Visual Studio to compile?

var isChromium = window.chrome;
Lambert
  • 2,233
  • 5
  • 29
  • 44

1 Answers1

2

You can extend Window interface anywhere in your code:

interface Window {
    chrome:any; //you can go further and define a strict shape of this member
}

Interface declarations can be split into multiple files - compiler will merge all interface declarations with the same name into single definition.

Aleksey L.
  • 35,047
  • 10
  • 74
  • 84