🙌 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
typekeywords to declare types.
interfaceis great for typing objects, especially within object-oriented programs.
- We can apply an
- 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
interfaceinto another using the
- 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
Use the code editor to polish your understanding of typing objects in TypeScript.