angularjstypescripttypescript-typingsangularjs-1.5

Installing angular 1.5 typings


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?


Solution

  • 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) 🌹