es6 variable property destructuring code example
Example 1: 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;
Example 2: object destructuring default value
let a, b;
[a=5, b=7] = [1];
console.log(a); // 1
console.log(b); // 7