Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to define types in typescript

type Person = {
  name: string;
  age: number;
};

const person: Person {
	named: 'Rex'
  	age: 23
}
 
function greet(person: Person) {
  return "Hello " + person.name;
}
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #define #types #typescript
ADD COMMENT
Topic
Name
9+8 =