> 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="https://4062235122-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7tekcoDYDaKhlNreT5uK%2Fuploads%2FnZyZvh5Ja5qZIDDfmE9y%2FTypescript%20%20Key%20Indexing%20Syntax.png?alt=media&amp;token=b2f26e43-f0d2-41fc-9d15-e0849e261b52" alt=""><figcaption></figcaption></figure>

### Index Signature&#x20;

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

<figure><img src="https://4062235122-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7tekcoDYDaKhlNreT5uK%2Fuploads%2Fn6Y49ONaSz73aUANWk7I%2FTypescript%20%20Key%20Indexing%20Number%20Syntax.png?alt=media&amp;token=3db831f3-9fc0-43fb-b2f2-5929b2ab934b" 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;
}
```
