Typescript tool

This script declares any properties of window object as 'any' type.
Of course, you have to adapt it to your needs.
      
var blackList = ['undefined'];
var body = document.querySelector('body code.generated');
Object.getOwnPropertyNames(window).forEach(function(prop) {
    if(blackList.indexOf(prop) == -1) {
        var declaration = document.createTextNode('declare var ' + prop + ': any;');
        var br = document.createElement('br');
        body.appendChild(br);
        body.appendChild(declaration);
    }
});
      
    
This result to the following declaration file: