TLDR While working on a real-life project, the author encountered a TypeScript implementation that lacked flexibility. They improved the design using the Map pattern, which reduced redundancy and potential errors by allowing dynamic additions. Further, stricter controls were applied to ensure only predefined reactions can be added. This approach balances flexibility and control, enhancing code maintainability.
🔗 https://dev.to/perisicnikola37/dont-use-typescript-types-like-this-use-map-pattern-instead-ki3
