ngc compile failed
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@anguar/cli: 1.0.2 node: 6.10.1 npm: 3.10.10 os: macOS Sierra
Repro steps.
- run
ng new myProjectcommand to create a new project; - under src/app folder, create a new file called xmlToJson.ts, and copy code from this website: http://coursesweb.net/javascript/convert-xml-json-javascript_s2. I even didn't import this file to any file, just let it be there.
- run
ng serve
The log given by the failure.
ERROR in path-to-myProject/src/app/studyloader/xmltoJSON.ts (15,79): Cannot find name 'ActiveXObject'.
ERROR in path-to-myProject/src/app/studyloader/xmltoJSON.ts (33,26): Cannot find name 'ActiveXObject'.
My code in line15:
var xhttp: any = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
My code in line 33:
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
I tried to install typescript 2.1.5 / 2.2.0, but still compile failed with command ng serve.
Desired functionality.
It should compiled successfully as it passed when I run "tsc path-to-app/xmlToJson.ts" What's the difference between typescript compiler and compiler-cli?
Mention any other details that might be useful.
I'm sorry, but this issue is not caused by Angular CLI. Please contact the author(s) of project http://coursesweb.net/javascript/convert-xml-json-javascript_s2 or file issue on their issue tracker.
Finally find the answer here: https://github.com/Microsoft/TypeScript/issues/2541
copy and paste ActiveXObject definition in typings.d.ts
declare var ActiveXObject: ActiveXObject;
interface ActiveXObject {
new (type: string): ActiveXObject;
SendKeys(key: string): void;
}
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.