i have a .ts file with this code:
var xhttp = new XMLHttpRequest();
when i run the grunt task to build the ts files with typescript, there are no errors. When i try to instance the class and call the function with this line appear this error:
ReferenceError: XMLHttpRequest is not defined at HttpRequester.send (C:**\\asset-player\\src\\assetlib\\HttpRequester.js:9:25) at AssetFinder.Asset.req (C:**\\asset-player\\src\\assetlib\\Asset.js:41:21) at Object. (C:**\\asset-player\\index.js:21:20) at Module._compile (module.js:397:26) at Object.Module._extensions..js (module.js:404:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:429:10) at startup (node.js:139:18) at node.js:999:3
You'll have to reference a file which (eventually) contains XMLHttpRequest
declaration.
That declaration is eventually here: https://github.com/Microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts
You may want to double-check your typescript configuration: https://github.com/Microsoft/TypeScript
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.