2

I saw examples for angular 2 which use typings.json:

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160725163759",
    "node": "registry:dt/node#6.0.0+20160831021119"
}

for installing necessary typescript files for certain packages.

Start from TypeScript 2.0 we can do it trough npm with '@types/...':

"devDependencies": {
    "@types/es6-shim": "0.31.32",
    "@types/node": "6.0.52"
  }

From my perspective second approach is more clear.

1) Can someone explain it in more detail, how to use, what is the difference ?

2) People also use script in npm to install typings:":

"scripts": {
  "postinstall": "typings install",
}

Is it necessary to use it for second approach if we put everything in npm packages, is "npm install" enough ?

Milos
  • 1,678
  • 4
  • 23
  • 49
  • It is explained in this blog post: [The Future of Declaration Files](https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/) – Nitzan Tomer Jan 26 '17 at 11:41
  • Possible duplicate of [typings vs @types NPM scope](http://stackoverflow.com/questions/39261204/typings-vs-types-npm-scope) – Estus Flask Jan 26 '17 at 11:42

1 Answers1

5

No you don't need the typings.json or typings if you are installing type definitions from @types/.

Martin
  • 15,820
  • 4
  • 47
  • 56