WeCodeAcademy

Type Aliases and Interfaces

Give a shape a name with type or interface so you can reuse it. They do almost the same job for objects.

Exampletypescript
Open in editor »

Interfaces can extend other interfaces to add properties.

Exampletypescript
Open in editor »
Quick check

How does an interface reuse another interface's properties?

Your turn: write the code

Define an interface Point with x and y numbers, create p at (3, 4), and print p.x * p.y.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.