与号 (&) 在 TypeScript 类型定义中是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38317625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does the ampersand (&) mean in a TypeScript type definition?
提问by Carl Patenaude Poulin
On line 60359 of this type definition file, there is the following declaration:
在这个类型定义文件的第 60359 行,有如下声明:
type ActivatedEventHandler = (ev: Windows.ApplicationModel.Activation.IActivatedEventArgs & WinRTEvent<any>) => void;
What does the &
sigil mean in this context?
&
在这种情况下,印记是什么意思?
采纳答案by basarat
&
in a type position means intersectiontype.
&
在类型位置意味着交叉类型。
More
更多的
https://www.typescriptlang.org/docs/handbook/advanced-types.html#intersection-types
https://www.typescriptlang.org/docs/handbook/advanced-types.html#intersection-types