microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
bead6d153df3e7bd00100e72ae51a740bba955e6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/language-basics/intersections.md

21lines · modepreview

---
id: intersections
title: Intersections
---

# Intersections

Intersections describe a type that must include all the intersection's constituents. Declare an intersection with the `&` operator.

```cadl
alias Dog = Animal & Pet;
```

An intersection is equivalent to [spreading](./models.md#spread) both types.

```cadl
alias Dog = {
  ...Animal;
  ...Pet;
};
```