4

I have a silly question regarding the @types dependencies in the package.json file:

In the following URL it is explained that the types should be installed as runtime dependency npm install --save @types/lodash TS 2.x d.ts Consumption

But to me is makes more sense to install the @types/.... packages as dev dependency npm install --save-dev @types/lodash

Any thoughts on this?

gevik
  • 3,177
  • 4
  • 25
  • 28

1 Answers1

12

Use --save when you are developing a module/library and wish to share the @types dependencies, otherwise use --save-dev.

some context: https://github.com/Microsoft/types-publisher/issues/81

shusson
  • 5,542
  • 34
  • 38
  • 2
    Additionally, see the comment of jedd.ahyoung to [this answer](http://stackoverflow.com/a/22004559/3786294) _"This is great! I never realized, but this answer has taught me that the dependencies vs devDependencies difference is only applicable if you're going to publish an npm package. If you're just working on an application or site, it shouldn't matter too much. Thanks! – jedd.ahyoung"_ – Paleo Feb 16 '17 at 09:45