Parameters<T>, ReturnType<T>, Awaited<T>
Utility Type များ အမြန်ကြည့် နိုင်ရန် (Cheat Sheet):
Section titled “Utility Type များ အမြန်ကြည့် နိုင်ရန် (Cheat Sheet):”Utility Type တွေရဲ့ အဓိက အချက်အလက်တွေကို အတိုချုပ် စာရင်း ပြန်လုပ်ပေးထားပါတယ်။
- Partial<T>: All properties optional.
T ရဲ့ Property အားလုံးကို Optional (ပါချင်မှပါ) ဖြစ်အောင် လုပ်ပေးတယ်။
- Required<T>: All properties required.
T ရဲ့ Property အားလုံးကို မဖြစ်မနေ (Required) ဖြစ်အောင် လုပ်ပေးတယ်။
- Readonly<T>: All properties readonly.
T ရဲ့ Property အားလုံးကို ပြင်လို့မရအောင် (Readonly) လုပ်ပေးတယ်။
- Pick<T, K>: Selects properties K from T.
T ထဲက ကိုယ်လိုချင်တဲ့ Property K တွေကို ရွေးထုတ်ပေးတယ်။
- Omit<T, K>: Removes properties K from T.
T ထဲက ကိုယ်မလိုချင်တဲ့ Property K တွေကို ဖယ်ထုတ်ပေးတယ်။
- Record<K, T>: Object with keys of type K and values of type T.
Key တွေက K Type ဖြစ်ပြီး Value တွေက T Type ဖြစ်တဲ့ Object တစ်ခုကို လုပ်ပေးတယ်။
- Exclude<T, U>: From union T, remove types assignable to U.
Union Type T ထဲက U နဲ့ တူတဲ့ Type တွေကို ဖယ်ထုတ်ပေးတယ်။
- Extract<T, U>: From union T, keep only types assignable to U.
Union Type T ထဲက U နဲ့ တူတဲ့ Type တွေကိုပဲ ထားပေးတယ်။
- **NonNullable<T>: Remove null and undefined from T. **
T ထဲက null နဲ့ undefined Type တွေကို ဖယ်ထုတ်ပေးတယ်။
- Parameters<F>: Tuple of function F’s parameter types.
Function F ရဲ့ Parameter တွေရဲ့ Type ကို Tuple အနေနဲ့ ထုတ်ပေးတယ်။
- ReturnType<F>: Return type of function F.
Function F ရဲ့ ပြန်လာသော result ရဲ့ Type ကို ထုတ်ပေးတယ်။
- Awaited<P>: Resolved type of Promise P.
Promise P ရဲ့ အထဲက ပြန်လာမယ့် (resolved) Type ကို ထုတ်ပေးတယ်။