ts destructuring type code example
Example: typescript object destructuring
// declare an interface or a type
interface Person {
name: string;
age: string;
}
// destructure name and age from `obj` variable.
const { name, age }: Person = obj;
// declare an interface or a type
interface Person {
name: string;
age: string;
}
// destructure name and age from `obj` variable.
const { name, age }: Person = obj;