DEV Community

Discussion on: Vanilla TypeScript (gts)

Collapse
 
elarcis profile image
Elarcis • Edited

There is a way to extend the Window interface and declare the type of your globals so that you don't lose TS's help (using any should always be avoided):in a typings.d.ts file possibly at the root of your source folder, write something like that:

declare global {
  interface Window {
    myGlobal: string;
  }
}
Thread Thread
 
rfornal profile image
bob.ts

Elegant. I’ve gone through a few other things. I’ll try it out.