Thuta Learning
TypeScript
IntermediateProgrammingintermediate

Objects

Object ၏ ပုံစံ (shape) ကို type annotation ဖြင့် သတ်မှတ်နိုင်သည်။ Object တွင် မည်သည့် properties များပါဝင်သင့်သည်၊ ၎င်းတို့၏ type များက ဘာလဲဆိုတာကို ကြိုတင်သတ်မှတ်ထားနိုင်သည်။

typescript
const person: { name: string; age: number } = {
  name: "John Doe",
  age: 30
};

console.log(`${person.name} is ${person.age} years old.`);
You should see
John Doe is 30 years old.