何时在搜索类型定义时使用环境? [英] When to use ambient while searching for a type definition?

查看:128
本文介绍了何时在搜索类型定义时使用环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从tsd迁移到打字,因为它已被弃用。
但是当我在寻找定义时需要使用 - ambient 时,它并不是很清楚。

I'm currently migrating from tsd to typings since it's deprecated. but It's not crystal clear when I need to use --ambient or not when looking for a definition.

另外:从长期来看,打字的目标是完全摆脱DefintelyTyped的ambiant声明,只依赖于打字注册表,这是否正确?

Also: is it correct to say that the goal of typings, in the longterm, is to completely move away from ambiant declatation from DefintelyTyped and only rely on the typings registry?

推荐答案


但是当我需要使用时,它并不是很清楚 - 赞助

but It's not crystal clear when I need to use --ambient



总是环境空白



改变全球性质的东西>环境(例如 node.d.ts )将始终为 ambient

Always Ambient Stuff

Stuff that changes the nature of the global environment (e.g. node.d.ts) will always be ambient.

对于作为模块的东西(例如像 debug这样的节点包)它可以转换为打字模块(事实上已经),所以你不需要 - ambient

For stuff that is a module (e.g. a node package like debug) it can be converted into a typings module (and in fact has been) so you don't need --ambient.

但是如果你使用 - ambient ,你仍然可以使用DefinitelyTyped中的定义。此外,如果未对 typings 进行转换,您只能 使用 - ambient

However you can still use the definition from DefinitelyTyped if you use --ambient. Also if the conversion hasn't taken place to typings you can only use --ambient.

这篇关于何时在搜索类型定义时使用环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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