I setup global namespaces for my objects by explicitly setting a property on window.
window.MyNamespace = window.MyNamespace || {};
TypeScript underlines MyNamespace and complains that:
The property 'MyNamespace' does not exist on value of type 'window' any"
I can make the code work by declaring MyNamespace as an ambient variable and dropping the window explicitness but I don't want to do that.
declare var MyNamespace: any;
MyNamespace = MyNamespace || {};
How can I keep window in there and make TypeScript happy?
As a side note I find it especially funny that TypeScript complains since it tells me that window is of type any which by definitely can contain anything.
 
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    
 
     
     
     
     
     
    


 
     
     
     
     
     
    
 
     
    