Imagine having an object that resembles the following:
const typeMap = {category1: Category1, category2: Category2}
In this case, Category1 and Category2 refer to classes, and there could potentially be hundreds of different categories.
Now I also have a dynamically generated object that matches up with this structure:
const instanceMap = {category1: new typeMap.category1(), category2: new typeMap.category2()}
The challenge arises when attempting to assign types to this instanceMap since it is created dynamically.
Using the standard "typeof typeMap" method doesn't provide accurate results. Even though I access instanceMap.category1, the methods belonging to Category1 aren't visible in the auto-complete suggestions. It appears that the typeof operator treats it as typeof CategoryX, leading to the loss of visibility for all associated methods.