microsoft/typespec

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
33d83ea24ba2f6df7d485c85eddc310754a0f5d6

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;
};
```