I have a web extension that applies a custom object on the window object like:
window.extensionName // { method1: () => {} }
However in my TypeScript files, when I reference window.extensionName
, I get this error:
Property 'extensionName' does not exist on type 'Window & typeof globalThis'.
But it does in fact exist on the window
object because it was added by the extension. How do I make TypeScript stop complaining about this?
And is there a way to specify the new object's type globally for my whole project so that TypeScript can use autocomplete?