1

I'm implementing window in my typescript project and I have to implement interface window as well.

Although works in typescript file doesn't make any difference in declaration type file

This work:

// somefile.ts

declare global {
  interface Window {
    something: boolean
  }
}

window.something = true

Not working:

// global.d.ts
declare global {
  interface Window {
    something: boolean
  }
}

// =============
// something.ts

window.something = true
pmqueiroz
  • 31
  • 3
  • Does this answer your question? [About "\*.d.ts" in TypeScript](https://stackoverflow.com/questions/21247278/about-d-ts-in-typescript) – Alan Yu Dec 04 '21 at 23:49
  • 1
    Not actually @AlexYu here in the typescript [docs](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) has the same example, but not working here – pmqueiroz Dec 04 '21 at 23:55

1 Answers1

-1

I think you need to add export {} to the global.d.ts file.

Jon
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 01 '23 at 13:27