One reason I really like TypeScript is its Type system, it is practical and feature rich. Applying the types in right use cases can make our code cleaner and easier to maintain.
The purpose of this article is to share an example of code refactoring with type script discriminated union type and Generics.
This piece of code is to represent user roles and feature/permissions mapping, to build a user access matrix in an Angular App.
The code above contains:
#javascript #typescript #programming