# TS - Unknown & Any

### Unknown & Any

<figure><img src="/files/0EcTIigZSRy53STauXBu" alt=""><figcaption></figcaption></figure>

`let unData : unknown = "hello";` ရေးထုံးနဲ့ `unknown` Type တွေကို သတ်မှတ် လို့ရပါတယ် ။

`let anyData : any = "hello";` ရေးထုံးနဲ့ `any` Type တွေကို သတ်မှတ် လို့ရပါတယ် ။ &#x20;

Priority Level ကို အရင် ကြည့်ရအောင် ။

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

`unknown` နဲ့ `any` type က Priority Level  အမြင့်ဆုံးတွေဖြစ်ပါတယ် ။\
&#x20;ဒီ Type တွေကို သတ်မှတ်ထားတဲ့အခါ အခြားတန်ဖိုးတွေအကုန် လက်ခံနိုင်ပါတယ် ။

### Any Type

ဘယ်လို Data type မဆို ကိုင်တွယ်နိုင်တဲ့ Flexible Type ဖြစ်ပါတယ် ။&#x20;

Strict Type-Checking ကို Disable လုပ်နိုင်စွမ်းရှိပါတယ် ။&#x20;

<figure><img src="/files/0yD9hamFHU5wK2RhWIup" alt=""><figcaption></figcaption></figure>

`any` Type ကို တတ်နိုင်သလောက် ရှောင်ပြီး သုံးသင့်ပါတယ် ။ \
သို့ပေ့မယ် လည်း Legacy JavaScript Code တွေကို Migrate လုပ်တဲ့အခါ ၊ API response ကို Handle လုပ်တဲ့အခါမှာ `any` Type ကို အသုံးပြုလေ့ ရှိကြပါတယ် ။

### Unknown Type

TypeScript မှာ `unknown` ကို `any` အစား Type-Safe အနေနဲ့ သုံးကြပါတယ် ။

သူလည်းပဲ အခြား Type အားလုံးကို Assign လုပ်လို့ရပါတယ် ။ သို့ပေ့မယ် `any` နဲ့ မတူတာက `method` `properties` တွေကို တိုက်ရိုက် ယူသုံးလို့ မရတာပဲဖြစ်ပါတယ် ။

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lwin-moe-paing.gitbook.io/typescript-baby-by-lwin-moe-paing/basic-typescript/ts-unknown-and-any.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
