Sireini
Sireini

Reputation: 4262

Angular2- How do I install a typing file?

I am trying to include some of these typings: https://github.com/DefinitelyTyped/DefinitelyTyped

Now I have the following file:

{
    "ambientDependencies": {
      "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
      "systemjs": "registry:dt/systemjs#0.18.4+20160417155658",
      "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#4cdfbe96b666eec5e1defbb519a62abf04e96764",
      "googlemaps.infobubble": "github:DefinitelyTyped/DefinitelyTyped/googlemaps.infobubble/google.maps.infobubble.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd"
    }
  }

How do I install these and how can I check if they are installed?

Upvotes: 3

Views: 4113

Answers (2)

Remo H. Jansen
Remo H. Jansen

Reputation: 24979

If you have a typings file already all you need to run is:

$ typings install

You need typings installed to run that command:

$ npm install -g typings

If you need more typings:

$ npm install dt~jquery --save --global

The flag dt~ refers to the source: DefinitelyTyped.

You can learn more here

Update: Solving "no dependencies" in release >= [email protected]

There has been a change in typings you are probably using an old version of the config...

You need to do the following:

Remove previous config:

$ rm -r typings.json typings

Update Typings:

$ npm install -g typings

Install new config:

$ typings init
$ typings install --save --global dt~es6-shim
$ typings install --save --global dt~systemjs
$ typings install --save --global dt~jquery
$ typings install --save --global dt~google.maps.infobubble

The result should be like the following:

{
  "version": false,
  "dependencies": {},
  "globalDependencies": {
    "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
    "google.maps.infobubble": "registry:dt/google.maps.infobubble#0.0.0+20160317120654",
    "jquery": "registry:dt/jquery#1.10.0+20160417213236",
    "systemjs": "registry:dt/systemjs#0.18.4+20160417155658"
  }
}

Save this file and the next time you need to reinstall:

$ typings install

Will do the job!

Upvotes: 5

Thierry Templier
Thierry Templier

Reputation: 202176

You can have a look at the typings folder at the root of your project. If they are present in it (see sub folders), they are installed...

Updated

As stated by @inukkusu, if you want to install what you define within the typings.json file use the command: typings install.

Upvotes: 1

Related Questions