Learn

🙌 Way to go! You have advanced through this entire lesson. No one will object to your superior TypeScript knowledge. Here’s an overview of what we learned:

  • We can use both interface and type keywords to declare types.
  • interface is great for typing objects, especially within object-oriented programs.
  • We can apply an interface on a class using the implements keyword.
  • Object types can be nested infinitely.
  • We can define multiple types and compose them together to organize our code and make it more flexible.
  • We can copy the type members of one interface into another using the extends keyword.
  • We can define variable property names within an object type with an index signature. An index signature uses syntax like: [propertyName: string]: string.
  • It’s possible to make some type members optional, using the ? operator. The syntax looks like name?: string.

Use the code editor to polish your understanding of typing objects in TypeScript.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?