typescript add objet to window code example
Example 1: typescript add global variable to window
declare global {
interface Window {
FB:any;
}
}
let FB = window.FB; // ok now
Example 2: Property 'editor' does not exist on type 'Window & typeof globalThis'.
declare global {
interface Window { MyNamespace: any; }
}
window.MyNamespace = window.MyNamespace || {};