> For the complete documentation index, see [llms.txt](https://lwin-moe-paing.gitbook.io/typescript-baby-by-lwin-moe-paing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lwin-moe-paing.gitbook.io/typescript-baby-by-lwin-moe-paing/basic-typescript/ts-index-type.md).

# TS - Index Type

<figure><img src="/files/7euIqXkAUSbcR51KRBuC" alt=""><figcaption></figcaption></figure>

### Index Signature&#x20;

TypeScript မှာ Index Signature ဆိုတာက object properties တွေကို dynamic key အနေနဲ့သုံးနိုင်ဖို့ သတ်မှတ်ပေးတဲ့ concept တစ်ခုပဲဖြစ်ပါတယ် ။ ရေးသားနည်း `[index: KeyType]` က property type သတ်မှတ်တာဖြစ်ပြီး `(:)` အနောက်မှာ value type တွေကိုသတ်မှတ်တာပဲဖြစ်ပါတယ် ။

<figure><img src="/files/Nwq0uFjRbBxesEWFtl8L" alt=""><figcaption></figcaption></figure>

နမူနာ code အရ `[index: number]: string` ရေးသားထားတာက keys တွေအားလုံး `number type` ဖြစ်ပြီး value တွေက `string type` ဖြစ်မယ်လို့ သတ်မှတ်ထားတာပါ ။

စာဖတ်သူတို့က key ကို `string` type ထားပြီး value ကို `booelan` type အဖြစ် မိမိ စက်ထဲမှာ ရေးသားကြည့်ပေးပါ ။

အဖြေက အောက်က Code အတိုင်း ဖြစ်မှာပါ ။

```typescript
type StrBooObj = {
    [index: string]: boolean;
}
```
