Complete the code to declare an object type for a person with a name and age.
type Person = { name: string; age: [1] };The age property should be a number because age is a numeric value.
Complete the code to create a variable with the Person type.
const user: [1] = { name: 'Alice', age: 30 };
The variable user should be typed as Person to match the object structure.
Fix the error in the function parameter type to accept a Person object.
function greet(person: [1]) { console.log(`Hello, ${person.name}`); }The function expects a Person type to access name property safely.
Fill both blanks to create a function that returns the person's age.
function getAge([1]: Person): [2] { return [1].age; }
The function takes a parameter named person of type Person and returns a number representing the age.
Fill all three blanks to create a typed object and access its properties.
type [1] = { [2]: string; [3]: number };
The type is named Person with properties name (string) and age (number).
