9

I used tsd which is now deprecated and am trying to use typings. The typings repository is very small, and I can't find any of the d.ts files I need. All the files I need are in GitHub DefinitelyTyped repository, but I can't find a way to install them using typings.

Here is a command I tried:

typings install github:DefinitelyTyped/DefinitelyTyped/angular-formly/angular-formly.d.ts

I receive the error:

typings ERR! message Attempted to compile "angular-formly" as a dependency, 
but it contains some ambient module declarations
("AngularFormly", "angular-formly").

Any clue?

pierrebo
  • 904
  • 2
  • 10
  • 22

3 Answers3

18

To install angular-formly definitions from DefinitelyTyped, use the following command:

typings install angular-formly --ambient

It's taken directly from here: Quick Start

EDIT: Because this is the accepted answer and syntax has changed, as of typings 1.0:

typings install dt~angular-formly --global
jfmercer
  • 3,641
  • 3
  • 29
  • 35
Amid
  • 21,508
  • 5
  • 57
  • 54
  • try it, it does not work - you receive an error message saying "unable to find angular-formly in the registry". If you look at the typings registry, it has only about 30 entries comared with the multiple hundreds in DefinitelyTypes. – pierrebo Feb 05 '16 at 23:00
  • I have tried it before posting. It does work. Moreover if you check the link it explicitly says that by using --ambient flag you will instruct 'typings' to check definately typed for definitions. Your problem is somewhere else. – Amid Feb 06 '16 at 07:40
  • my bad, you are right (I misspelled ambient to ambiant - the problem being french speaking sometimes!) – pierrebo Feb 17 '16 at 13:30
  • So, what does the `ambient` flag do that makes it work? – Bruno Brant Apr 29 '16 at 19:58
  • This adds the dependency to the project but apparently you need to instal the dependency manually.... How do you install the dependency manually? – JMStudios.jrichardson Aug 09 '16 at 23:18
  • This adds typescript definitions to the project. Not dependency. If you want to add dependency (whose definitions you had installed with `typings`) - add it to `package.json` -> `dependencies` and then run `npm install` to fetch it. – Amid Aug 10 '16 at 18:36
13

As of version 1.X of typings the syntax has changed and is now:

typings install dt~angular-formly --global

update: As of typescript 2.0 types are installed using npm: npm install @types/angular-formly

Ofer Herman
  • 3,018
  • 1
  • 20
  • 21
  • 1
    Thank you! This isn't well-documented across the web. The typings project documented it well, but of all of the tutorials and SO answers I've read, this is the first I've found that mentions this. Crucial. More info: https://github.com/typings/typings/releases/tag/v1.0.0 – rinogo May 24 '16 at 20:49
  • 2
    **Note the tilde**: dtangular-formly – spiffytech May 28 '16 at 18:42
  • I was motivated to attempt to author something comprehensive related to finding / using typings https://neoheurist.wordpress.com/2016/06/20/definitely-typed/ comments and feedback welcome/requested - I want it to be as useful / authoritative as possible – Neoheurist Jun 21 '16 at 18:28
4

I use the following:

./node_modules/.bin/typings install whatever --save --global --source dt

Seems to be the way to do it in v1.3.1.

yurisich
  • 6,991
  • 7
  • 42
  • 63