The benefits of FP

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 ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.