Show List

TypeScript Objects

Below is a JavaScript Object declaration:

let person = {
  firstName: "John",
  lastName: "Miller",
  age: 35,
};

This object can be declared in TypeScript as below:
let person: { firstName: string, lastName: string, age: number } = {
  firstName: "John",
  lastName: "Miller",
  age: 35,
};

    Leave a Comment


  • captcha text