How to install .d.ts file from github:DefinitelyTypes using typings

15,775

Solution 1

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

Solution 2

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

Solution 3

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.

Share:
15,775
pierrebo
Author by

pierrebo

SharePoint Solution Architect and ex-Microsoft guy. Doing SPA development using Angular on SharePoint.

Updated on July 21, 2022

Comments

  • pierrebo
    pierrebo almost 2 years

    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
    pierrebo about 8 years
    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.
  • Amid
    Amid about 8 years
    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.
  • pierrebo
    pierrebo about 8 years
    my bad, you are right (I misspelled ambient to ambiant - the problem being french speaking sometimes!)
  • Bruno Brant
    Bruno Brant about 8 years
    So, what does the ambient flag do that makes it work?
  • TommyAutoMagically
    TommyAutoMagically almost 8 years
    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: github.com/typings/typings/releases/tag/v1.0.0
  • spiffytech
    spiffytech almost 8 years
    Note the tilde: dt<tilde>angular-formly
  • Neoheurist
    Neoheurist almost 8 years
    I was motivated to attempt to author something comprehensive related to finding / using typings neoheurist.wordpress.com/2016/06/20/definitely-typed comments and feedback welcome/requested - I want it to be as useful / authoritative as possible
  • JMStudios.jrichardson
    JMStudios.jrichardson over 7 years
    This adds the dependency to the project but apparently you need to instal the dependency manually.... How do you install the dependency manually?
  • Amid
    Amid over 7 years
    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.