Demonstrates how to declare a global object on window
in TypeScript.
-
- Add a new
ambient.d.ts
file to your project, this should not contain code so putting it in the top-level should be ok. In this file we declare the so-called "ambient context" for our app.
- Add a new
-
- The project code now sees our new global property with the correct type
See TypeScript Declaration Merging for details.