for typescript 2.x:
definitions from DefinitelyTyped are available via @types npm package
npm i --save lodash
npm i --save-dev @types/lodash
but in case if you want use types from other repos then can be used old way:
for typescript 1.x:
Typings is an npm package that can automatically install type definition files into a local project. I recommend that you read the quickstart.
npm install -global typings
Now we have access to the typings cli.
typings search lodash
NAME SOURCE HOMEPAGE DESCRIPTION VERSIONS UPDATED
lodash dt <http://lodash.com/> 2 2016-07-20T00:13:09.000Z
lodash global 1 2016-07-01T20:51:07.000Z
lodash npm <https://www.npmjs.com/package/lodash> 1 2016-07-01T20:51:07.000Z
typings install dt~lodash --global --save
Let’s break down the last command. We are installing the DefinitelyTyped version of lodash as a global typings file in our project and saving it as a dependency in the typings.json
. Now wherever we import lodash, typescript will load the lodash typings file.
--save-dev
flag:typings install chai --save-dev