Types Are Sets (and Optional Properties Blow Them Up)
One widely used TypeScript feature is the ability to have optional keys on objects. However, this poses a problem that becomes more significant as the system and state become more complex. Other type systems allow this problem to be circumvented. Let’s take a closer look. Before we dive-in In TypeScript (and most type systems), a type is best understood as a set of possible values. In other words, type Name = string | null; … means “Name is the set of all strings plus the value null”. This is why it is called a Sum type, or Tagged union. ...