> 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-never.md).

# TS - Never

<figure><img src="/files/3ipq8bMdv8gbwF23kxwr" alt=""><figcaption></figcaption></figure>

`let neverData : never;` ရေးသားနည်းနဲ့ `never` Type တွေကို သတ်မှတ် လို့ရပါတယ် ။&#x20;

ထူးခြားတာက  Never Type ထဲကို ဘယ်တန်ဖိုး အမျိုးအစားမှ Assign လုပ်လို့တော့မရပါဘူး ။

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

ဒါဆို Assign လို့လည်းမရဘဲ ဘာလို့ `never` type ကို လေ့လာနေရတာတုန်းလို့ ပြောစရာရှိလာပြီ ။ ကျွန်တော်တို့ကိုယ်တိုင် Assign မလုပ်ပေမယ့်လည်း အခြား အခြေအနေတွေမှာ `never` type တွေကို တွေ့လာနိုင်ပါတယ် ။ ဥပမာ Error Throw လိုက်တဲ့ Function ရဲ့ Return Value Type က  `never`  ဖြစ်ပါတယ် ။

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

ဘယ်တော့ မှ မပြီးဆုံးနိုင်တဲ့ `while` loop ကို true conditional ထည့်လိုက်တဲ့ function မျိုးမှာလည်း `never` type ကိုရရှိလာနိုင်ပါတယ် ။

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

နောက်ဆုံးတစ်ခုကတော့ Switch နဲ့ စစ်တဲ့အခါ default scope ရောက်တဲ့အခါ စစ်လိုက်တဲ့ Data က never type အဖြစ် Type Cast ဖြစ်သွားတာမျိုးကို တွေ့ရမှာပါ ။
