Restricting a Typescript Type to a Set of Numbers | Task

Ole Ersoy
Feb - 10  -  1 min

Scenario

We need a Typescript type that restricts a Quadrant to the numbers 1,2,3,4.

Approach

type Quadrant = 1 | 2 | 3 | 4;

Demo