Writing TypeScript code using an FP style has many benefits, among which we can highlight the following:
- Testable code: If we try to write our functions pure functions, we will be able to write unit tests extremely easily.
- Code is easy to reason about: FP can seem hard to understand for developers with a lack of experience in FP. However, when an application is implemented correctly using the FP paradigm, the results are very small functions (often one-line functions) and very declarative APIs that can be reasoned about with ease.
- Concurrency: Most of our functions are stateless, and our entities are mostly stateless. We push state out of the core of our application, which makes our applications much more likely to be ...