What does the symbol "ampersand (&)" in TypeScript type definitions mean?
P粉668804228
2023-08-22 17:25:53
<p>In line 60359 of this type definition file, there is the following statement: </p>
<pre class="brush:php;toolbar:false;">type ActivatedEventHandler = (
ev: Windows.ApplicationModel.Activation.IActivatedEventArgs
& WinRTEvent<any>
) => void;</pre>
<p>In this context, what does the <code>&</code> symbol mean? </p>
Intersection types in Typescript
example:
&
represents the intersection type in the type position.More TypeScript documentation on intersection types:
https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types
Quoted from the above document: