在 typescript 2.0 中搜索类型定义的规范方法 [英] Canonical way to search type definitions in typescript 2.0

查看:52
本文介绍了在 typescript 2.0 中搜索类型定义的规范方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于打字稿 2.0 而不是打字,我们是 应该使用 npm install @types/.

Since typescript 2.0 instead of typings we are supposed to use npm install @types/<package-name>.

在打字中,我们有 typings search 命令用于包查找.我的问题是 - 在@types 中搜索类型定义的规范方法是什么?

In typings we have typings search command for package lookups. My question is - what is the canonical way to search type definitions in @types?

所以,澄清一下,到目前为止的工作流程是:

So, to clarify, till now the workflow was:

  1. typings search
  2. typings install [--global]

现在:

  1. 问题是关于这一步
  2. npm install --save-dev @types/

推荐答案

不确定控制台是否可行,但 Microsoft 已提供此工具 在线 来做到这一点.您可以在此中找到更多详细信息发布.

Not sure if this is possible with console, but Microsoft has provided this tool online to do that. You can find more details in this post.

我想这个想法是在 @types/ 之后保留所有名称.因此,如果 npm 包名称是 my-test-package,那么您应该拥有 @types/my-test-package(如果它存在并且可以使用名称).

I guess the idea is that all the names are maintained after @types/. So if the npm package name is my-test-package, then you should have @types/my-test-package if it exists at all and name can be used.

不幸的是,似乎 NPM UI 本身(以及最有可能用于同一响应的 API)在搜索以 @ 开头的内容时相当糟糕,因此 @types> 和 @angular 没有给你预期的结果.我确实认为这是一个错误,希望它会得到修复.

Unfortunately it seems that the NPM UI itself (and most likely API for the same reson) is rather bad with search for stuff that starts with @, so both @types and @angular does not give you the expected result. I do believe it's a bug and hope it'll be fixed.

这篇关于在 typescript 2.0 中搜索类型定义的规范方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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