Why doesn't typescript have a throws type to annotate functions that can throw an error?

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
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Sonar - Write Clean JavaScript Code. Always.
  • Zigi - The context switching struggle is real
  • TypeScript

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

    It has been extensively discussed: https://github.com/microsoft/TypeScript/issues/13219

  • neverthrow

    Type-Safe Errors for JS & TypeScript

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

  • fp-ts

    Functional programming in TypeScript

    Yep. In many languages you could return Either and that data structure composes nicely. Lots of ways to do that in typescript. fp-ts is my favorite. Especially nice is using Try which is a specialized version of Either.

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