I've been using the command line and installing TypeScript
type definition files .d.ts
using Typings
from the command line like the following:
typings install dt~jquery --global --save
This works perfectly and if done at the root of my project, it gets installed to the typings/globals
directory.
I recently had seen tutorials adding typings
installations via the devDependencies
section in the package.json
file for npm
to install like the following:
"devDependencies": {
"@types/core-js": "0.9.34"
}
I actually did the above and couldn't even find where the d.ts
file was put as I didn't see it anywhere in the node_modules
folder.
What is the difference between installing typings from the (2) methods above, and where do the typings files end up if using npm
to install and pull down the files?
Installing types with npm scoped package
@types
is the new official way in TypeScript 2.0. See What’s New in TypeScript 2.0? / Simplified Declaration File (.d.ts) Acquisition :The typing files are installed inside the
node_modules/@types
directory. So the file you are looking for can be found herenode_modules/@types/core-js/index.d.ts
In fact they are simple node-modules, TS 2.0. know how to handle properly.