Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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;
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #typescript #object #destructuring
ADD COMMENT
Topic
Name
5+4 =