> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/appendix/typescript/type/annotation.md).

# type annotation

{% tabs %}
{% tab title="type annotation" %}

```typescript
// ⭐️ type annotation
//        ╭──────╮
let myName: string = "Alice";                   // on variable
//                 ╭──────╮
function greet(name: string) { log(name) }      // on parameter
//                  ╭──────╮
function twentySix(): number { return 26; }     // on return type
```

{% endtab %}

{% tab title="📗 參考" %}

* 📘 [Type Annotations](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-annotations-on-variables)
  {% endtab %}
  {% endtabs %}
