Should typescript declaration in package.json go in "dependencies", "devDependencies" or both? Based on some basic googling, I think I've seen references to putting the typescript declaration in either location. Does the package.json structure support a shared section for scenarios where the declaration should go in both "dependencies" and "devDependencies"? Or, if a developer sees a need for both scenarios then is he simply required to replicate the declaration in both locations?
Asked
Active
Viewed 8,828 times
13
-
Does someone need TS to *use* your library, or just to *develop* on it? Are your releases going to be packaged JS with an index file for use if they are using TS? – jonrsharpe Jul 20 '17 at 16:29
-
TypeScript is not special. The answer to where to put it is exactly the same as any other NPM package you use, and the reason you found packages that included it in `dependencies` and some that included in `devDependencies` is because it entirely depends on what kind of package you are building. – Louis Jul 20 '17 at 16:34
-
typescript provides a programming language that runs on top of javascript. I would need typescript installed in order to get typescript development features while developing in visual studio. I would think that some type of typescript suppport would be needed for deployed typescript apps as well, at least in some scenarios. so is this a scenario where the typescript declaration should be duplicated in both "dependencies" as well as "devDependencies"? – user8334943 Jul 20 '17 at 16:40
-
10Normally typescript files get compiled into javascript, and the javascript gets deployed. If that's the case, typescript is not needed at runtime. – libertyernie Jul 20 '17 at 19:07
-
@libertyearnie - but when debugging in cdt, typescript is much more friendly to debug than the underlying js which is generated from it – user8334943 Jul 20 '17 at 23:18
-
1Two days before: [*How do I decide whether @types/\* goes into `dependencies` or `devDependencies`?*](https://stackoverflow.com/questions/45176661/how-do-i-decide-whether-types-goes-into-dependencies-or-devdependencies). – Franklin Yu Jan 18 '18 at 06:26
1 Answers
-6
In the dependencies
you should keep those libraries which are common at the runtime.
In the devDependencies
you should keep those which are needed to build the project.

Maciej Treder
- 11,866
- 5
- 51
- 74