人们为什么将typescript的类型存储为package.json中的依赖项(而不是devDep)? [英] Why do people store typescript's types as dependency in package.json (instead of devDep)?

查看:257
本文介绍了人们为什么将typescript的类型存储为package.json中的依赖项(而不是devDep)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎在所有有关打字稿的教程或博客文章中都注意到,人们只是通过npm安装用于类型和/或打字稿相关模块的软件包作为依赖项. 这是与编译时相关的事情,最终用户将永远不必加载它,因此对我而言,这在逻辑上应该都是隐含的.详细信息,然后转到package.json的devDependecies部分. 我以为我缺少什么,想要一个紧凑而合理的答案:)

I noticed in almost all tutorials or blog posts about typescript, people just install packages via npm for types and/or typescript related modules as dependency. This is compile-time related thing and end user will never have to load this, so for me logically this should all be impl. detail and thus go to devDependecies part of package.json. I'm assuming that I'm missing something and would like the compact yet reasonable answer :)

推荐答案

虽然这是我在撰写本文时在'17的立场,但我被证明是相反的证据.有关更多信息,请参见链接重复项详细信息.


因为它们懒惰/不了解它们之间的差异.


Because they are lazy/ignorant of the difference.

@types绝对应该是devDependencies,您不希望在npm i some-package时安装它们,仅当您克隆代码并调用npm i时.

@types should definitely be devDependencies, you don't want them installed when you npm i some-package, only when you clone the code and call npm i.

您完全正确.

You are completely right.

这篇关于人们为什么将typescript的类型存储为package.json中的依赖项(而不是devDep)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆