typings.json not getting updated typings install --ambient


I used to work with tsd for managing my type definitions, but as it's deprecated, I'm trying to migrate to typings which is my opinion more complicated, but should be the way to go, I guess.

I want to install a type definition and for that I use the --ambient flag.

In Visual Studio I have the typings.json file which looks like that:

  "name": "Test",
  "version": false,
  "ambientDependencies": {
    "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#ca92a5b250433c38230b5f4138b36453862342bf",
    "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#ca92a5b250433c38230b5f4138b36453862342bf"

This was automatically created when migrating from tsd to typings but now once I need a new type definition, for instance angular-route I use the following command:

typings install angular-route --ambient

This works fine, but the typings.json does not get updated.

What is the point and why am I missing? Why were angular and jquery both migrated to typings.json and when installing angular-routethe file does not get refreshed?

Problem courtesy of: dag


You forgot --save

typings install angular-route --ambient --save

command syntax above is now obsolete and only applicable to version 0.x

Link to Typings command help


As pointed out by @AndresM there are breaking changes in going from version 0.x to 1.x. See the documentation Updating From 0.x to 1.0?. The command syntax in @AndresM answer is the correct way to execute a typings command using DefinitelyTyped store and Typings version 1.x.

Solution courtesy of: Igor


Now with Typescript2.0(https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/) the global is also gone. The following will install jQuery and angular typings:

npm install --save @types/angular @types/jquery

Your package.json will then have:

"dependencies": {
  "@types/angular": "^1.5.16",
  "@types/jquery": "^2.0.33"

Your node_modules directory will have @types/angular and @types/jquery directories which contain index.d.ts files.

Discussion courtesy of: randominstanceOfLivingThing

Actually in Typings 1.0 they did some breaking changes. "ambient" is now "global". Just in case, installing from DefinitelyTyped must be explicit.

The following will install jQuery and save it to typings.json

typings install dt~jquery --global --save

See the link in Igor's answer for more info

Discussion courtesy of: Andres M

This recipe can be found in it's original form on Stack Over Flow.