This week I had the need to create a rather simple object that I wanted to be properly typed. This object consists of a couple of enums that will be categories with sub-categories that contain an object. This is a simple enough structure really:
const categories = {
category1: {
sub-category: {…}
},
category2: {
sub-category: {…}
}
}
So, let’s type this out shall we? First we need to define the object that will be the value of the sub-categories.