The shapes

In keeping with the principles that we learned in the previous chapter, we will need a variety of different types to perform different tasks within our application. We will need a representation of what shapes are, how to draw them, something to interact with the user interface, and somewhere to maintain the list of objects to be drawn.

Basic shapes

The first thing we need is a set of classes that will represent the different shapes that we eventually intend on drawing. These objects should be kept separate from the drawing logic that we will implement later. The first thing we need to do is create an abstraction for each of the shapes we intend on representing. This abstraction will allow us to easily extend object types or swap certain ...

Get TypeScript Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.