本文介绍了Typescript @types软件包的版本应该与它们的非type软件包匹配吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
@types是否使用与无类型包相同的版本?
Do @types use the same versioning as the untyped package?
npm i bluebird @types/bluebird -S
给我
"@types/bluebird": "^3.5.0",
"bluebird": "^3.5.0",
似乎很合理.
npm i request @types/request -S
给我
"@types/request": "0.0.41",
"request": "^2.81.0",
现在这让我有些害怕.这是否意味着我们仅具有请求版本0.0.41的请求类型?
Now this scares me a bit. Does this mean that we only have request types for request version 0.0.41?
推荐答案
不. JS包的TypeScript类型是尽力而为的,它取决于
No. TypeScript types for JS packages is best effort and depends on
- 官方js文档(通常缺少)
- 社区对包装的兴趣
因此,只要您了解其尽力而为的性质,版本不匹配就可以了.
So version mismatches are fine as long as you are aware of their best effort nature.
这篇关于Typescript @types软件包的版本应该与它们的非type软件包匹配吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!