Stop catching errors in TypeScript; Use the Either type to make your code predictable

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

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • ts-option

  • I've went through an fp-ts phase, used it a lot on a couple side projects, and all it did was create a massive overhead + verbose code for the simplest problems. Way easier & productive to grab a simple option type like ts-option for nullables, sprinkle in some ts-pattern for pattern matching, and then use typescript's built-in discriminated union for variants & result types

  • ts-pattern

    🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference.

  • I've went through an fp-ts phase, used it a lot on a couple side projects, and all it did was create a massive overhead + verbose code for the simplest problems. Way easier & productive to grab a simple option type like ts-option for nullables, sprinkle in some ts-pattern for pattern matching, and then use typescript's built-in discriminated union for variants & result types

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • proposal-explicit-exceptions

    Proposal to improve exception handling in EcmaScript

  • await-to-js

    Async await wrapper for easy error handling without try-catch

  • Someone even thought the same and made it a lib. https://github.com/scopsy/await-to-js

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