angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ngc compile failed

Open junjunruan opened this issue 9 years ago • 4 comments

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.

  1. run ng new myProject command to create a new project;
  2. 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.
  3. 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.

junjunruan avatar May 05 '17 20:05 junjunruan

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.

filipesilva avatar May 08 '17 10:05 filipesilva

Finally find the answer here: https://github.com/Microsoft/TypeScript/issues/2541

junjunruan avatar May 12 '17 15:05 junjunruan

copy and paste ActiveXObject definition in typings.d.ts declare var ActiveXObject: ActiveXObject; interface ActiveXObject { new (type: string): ActiveXObject; SendKeys(key: string): void; }

lucasm08 avatar Nov 28 '18 10:11 lucasm08

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.