Strongly Typed Error Handling in TypeScript

This page summarizes the projects mentioned and recommended in the original post on dev.to

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

    Common javascript functions used by andculture development

    This pattern gives us a more functional approach to error handling, gives us strongly typed errors, and works really, really nicely when used in combination with React hooks. Let’s take a look at a simple React example using some infrastructure from AndcultureCode.JavaScript.Core, AndcultureCode.JavaScript.React and AndcultureCode.JavaScript.React.Components:

  • TypeScript

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

    TypeScript is a great language. TypeScript takes JavaScript and makes it actually good. If there’s one glaring weakness, it’s the inability to use strongly typed catch blocks. However, this is mostly due to a design flaw in the JavaScript language; in JavaScript, you can throw anything, not just Error 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.

  • immutable-js

    Immutable persistent data collections for Javascript which increase efficiency and simplicity.

    Let’s consider an example using some utilities from AndcultureCode.JavaScript.Core and AndcultureCode.JavaScript.React, which wrap up API responses and errors in ResultRecord and ResultErrorRecord Immutable.js Record types.

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