I am working on a small asynchronous library for my projects. I decided to encode it in TypeScript, but my compiler gives me an error message 'XMLHttpRequest' does not exist on type 'Window', as the header says.
What I wanted to achieve was creating an ActiveXObject if there is no XMLHttprequest in the window.
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
I do not need to turn it on, but I wonder why?
IDE I am using VS code (which also shows me an error) and I am compiling with gulp-tsify
source
share