microsoft/typespec

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ce9c567e5bfb441bb6415699a6b6fa797bc08f2e

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/language-basics/alias.md

14lines · modepreview

---
id: aliases
title: Aliases
---

# Aliases

Aliases are a convenient way to define shorthand for types, especially when dealing with complex expressions. They simplify the syntax but don't have a representation in the type graph. As a result, you can't decorate aliases. If you need to give an alternate name to a model, use [`model is`](./models.md).

You can define an alias using the `alias` keyword.

```typespec
alias Options = "one" | "two";
```