help refactoring this pattern matching function

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
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • ts-pattern

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

  • Unfortunately I can't at the moment. It's unpublished and hosted on my private server and barely touched over the last few years. When ts-pattern was published I stopped working on it (except for when TS improved the recursion limit, I played with it again). I can copy the type states into a playground when I get to a computer I can access it from. However this playground has a basic implementation of what /u/josephjnk described. The tradeoff between this and what I've described is that, here, the end user needs to use typeguards for every predicate vs. you having to make complex types to support every weird corner case of inference the compiler throws at you.

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