Horje
how to declare an object in typescript Code Example
how to declare an object in typescript
/*They can be anonymous*/
function greet(person: { name: string; age: number }) {
  return "Hello " + person.name;
}
/*or named using an interface*/
interface Person {
  name: string;
  age: number;
}
 
function greet(person: Person) {
  return "Hello " + person.name;
}
/*or with a type alias*/
type Person = {
  name: string;
  age: number;
};
 
function greet(person: Person) {
  return "Hello " + person.name;
}




Typescript

Related
type alias in typescript Code Example type alias in typescript Code Example
remove dots and commas java Code Example remove dots and commas java Code Example
ts new example Code Example ts new example Code Example
whcih commands lets you an ip adress log Code Example whcih commands lets you an ip adress log Code Example
typescript allow object subset of interface Code Example typescript allow object subset of interface Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7