5

I am getting the error messages Module "ng" has no exported member on all of my typings in visual studio code

enter image description here

enter image description here

My typing are were working 100% until i added angular-ui-router. I am not sure if this is the problem but i only noticed it after adding that.

In my .d.ts files i get a specific error on angular itself.

enter image description here

My tsd.json looks like this

{
  "version": "v4",
  "repo": "borisyankov/DefinitelyTyped",
  "ref": "master",
  "path": "typings",
  "bundle": "typings/tsd.d.ts",
  "installed": {
    "angular-material/angular-material.d.ts": {
      "commit": "5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff"
    },
    "jquery/jquery.d.ts": {
      "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"
    },
    "angularjs/angular.d.ts": {
      "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"
    },
    "angularjs/angular-route.d.ts": {
      "commit": "5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff"
    },
    "angularjs/angular-cookies.d.ts": {
      "commit": "5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff"
    },
    "angularjs/angular-animate.d.ts": {
      "commit": "5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff"
    },
    "angularjs/angular-resource.d.ts": {
      "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"
    },
    "angular-ui-router/angular-ui-router.d.ts": {
      "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"
    }
  }
}

I am a bit lost to what i have or have not done to mess this up. The weird thing is that everything still works 100%. So i am still getting intellsense for ng. It just says that there are errors and everytime i build i am getting multiply errors on all the files.

Update

I ended up commenting out import ng = angular; on line 17 and then changing ng.auto.IInjectorService; to angular.auto.IInjectorService; on line 173 in angular.d.ts

This means that every reference in the angular app is now made with angular and not ng , which is not ideal but it will do for now. I am pretty sure this is not a "best practice" fix .

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/7284

  • 2
    *Just a hint - [here](http://stackoverflow.com/a/25072946/1679310) I tried to describe my issues with UI-Router d.ts* – Radim Köhler Dec 20 '15 at 12:29
  • @RadimKöhler That didnt work. Angular ui router destroys everything in the typing , completely . How is anyone else using this? –  Dec 20 '15 at 14:02
  • So it says you have a duplicate definition of var `angular`. Your problem is just here. Do you know where the two declarations are? – Louay Alakkad Dec 20 '15 at 16:09
  • I had the same problem, once. I think I just removed the "declare var angular..." expression in the type definition file. – Frode Dec 20 '15 at 22:29
  • So after working on this for a day, i am still not 100% sure what solved the problem but every time i make a change to the typing I need to close vscode and reopen it. This seems to fix the errors. Not sure why but it does. I have also left tsconfig.json empty for now –  Dec 21 '15 at 06:18

1 Answers1

1

Check wherever you installed angular-ui-router for an extra .d.ts file. Something like

./bower_components/angular-ui-router/api/angular-ui-router.d.ts

Delete that .d.ts file and restart VSCode. If it's not there check the rest of the folders in your project for any duplicate .d.ts files. This is what solved the issue for me.

Luke
  • 156
  • 5