Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to define types in typescript

interface Person {
  name: string;
  age: number;
}

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