Featured Post

Show HN: LegendAI-Amazon Sales Tracker https://ift.tt/Qmk4XB9

Show HN: LegendAI-Amazon Sales Tracker Get Actual Not Estimate Amazon Product Data! Real-Time Amazon Sales and Data Insights. Get accurate s...

Monday, March 6, 2023

Show HN: Tagged Unions and Factories in TypeScript https://ift.tt/Z26bj7W

Show HN: Tagged Unions and Factories in TypeScript Wish sum types got more love in TypeScript. I have settled on this style to minimize the boilerplate code needed to write tagged unions and tagged union factories. Lines 1-8 are helper functions for declaring tagged union types. They are used for non-generic tagged unions. Non-generic tagged unions' types should be inferred correctly. Generic tagged unions are super hard to type, as TypeScript only allows functions to be typed as generic values. Wish you enjoy this as well. https://ift.tt/oVtnv5x March 6, 2023 at 06:35AM

No comments:

Post a Comment