Question about error handling in Typescript

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/typescript

Our great sponsors
  • Scout APM - Truly a developer’s best friend
  • Zigi - Close all those tabs. Zigi will handle your updates.
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Sonar - Write Clean JavaScript Code. Always.
  • TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    Typed catch clauses are unfortunately not possible in TypeScript (although highly demanded). The closest to handle that would be to implement type guards that can identify your error and then handle it properly. I made a video about this technique: https://www.youtube.com/watch?v=0GLYiJUBz6k

  • fp-ts

    Functional programming in TypeScript

    With fp-ts and sum-types you'd handle this functionally like so:

  • Scout APM

    Truly a developer’s best friend. Scout APM is great for developers who want to find and fix performance issues in their applications. With Scout, we'll take care of the bugs so you can focus on building great things 🚀.

  • sum-types

    Safe, ergonomic, non-generic sum types in TypeScript.

    With fp-ts and sum-types you'd handle this functionally like so:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts