Installing angular 1.5 typings

12,166

Solution 1

I see that although it does declare a global angular variable, it also declares a module "angular"

The whole file is still global. i.e. there can be only one declare module "angular". Hence you still need to global flag (typings install dt~angular --global) 🌹

Solution 2

with TypeScript 2.0, you can make package.json file like this:

{
    ...
    "dependencies": {
        "@types/angular": "^1.5.6",
    }
    ...
}

Now, you can just run npm install!

Share:
12,166
Aaron Beall
Author by

Aaron Beall

Love to create things on the web. Currently ♥ TypeScript, React, Redux, NodeJS, Webpack. Yes, I'm available for hire. Feel free to contact me.

Updated on June 19, 2022

Comments

  • Aaron Beall
    Aaron Beall about 2 years

    Update 3/26/2017

    I now use npm install @types/angular with TypeScript 2.0 and the experience so far has been much smoother than typings was.

    Original

    I have an Angular 1.5 project using ES6 modules and Webpack, which is very similar to this starter project.

    I am attempting to install typings for Angular 1.5. I've used tsd in the past, but this is the first time I've tried to use the newer typings manager.

    When I try typings install angular I get:

    "Unable to find "angular" ("npm") in the registry."
    

    When I run typings search angular I see a result NAME: angular, SOURCE: dt.

    When I try typings install angular dt~angular I get:

    "Attempted to compile "angular" as an external module, but it looks like a global module." 
    

    However when I look at DefinitelyTyped/angular.d.ts I see that although it does declare a global angular variable, it also declares a module "angular", as many of the DefinitelyTyped definitions do to support UMD.

    How can I get this to work with typings? Or should I just stick with tsd?

  • eusoj
    eusoj almost 8 years
    If jQueryStatic warning appears, try: typings install dt~jquery --global --save
  • dbardakov
    dbardakov almost 6 years
    Since Typings are deprecated, use npm for the purpose, like in the next answer