Stephane Bersieraiconversations.hashnode.dev·Nov 8, 2024Untagged Algebraic Data Types, with ChatGPTThe following is an edited version of an article written by ChatGPT, after some back-and-forth. This summary explores untagged algebraic data types (ADTs), focusing on their similarities and differences with traditional tagged ADTs. We examine union ...ConversationsWithChatGPT
Akshat Soniakshatsoni.hashnode.dev·Aug 25, 2024Single vs Double Bars in TypeScript: A Key ComparisonThis blog post will show the difference between these two operators. In TypeScript, operators are essential tools that allow us to manipulate data and control the flow of applications. Among the various operators, the pipe symbol (|) and the double p...TypeScript Operators
Krijan Prajapatikrijanprajapati.com.np·Jul 13, 2024Union in TypescriptUnion in typescript allows the variable to hold more than one type of value. It is useful when variable can be of various types. It is defined by | operator between types. //Simple Union let randomValue:string|number=12; randomValue="John Doe"; //ran...TypescriptTypeScript
Lucas Payrfunctional-fieldnotes.hashnode.dev·May 22, 20243 Reasons Enums with superpowers Are Rare in Enterprise SoftwareYou might have heard of "Enums with superpowers", "Tagged Union Types" or Algebraic Data Types(ADT). It is heavily used in functional programming. And yet, you rarely see them in enterprise codebases. Why is that? A common use case for ADTs is to rep...Functional Programming
Ugne Adomaityteugneadomaityte.hashnode.dev·Mar 25, 2024Union Types and Enumerations ExplainedTypeScript as a strictly typed language offers many great features such as union types and enumerations. Features as such are widely used in TypeScript programming and allow developers to write flexible and clean code that is strictly typed. If you n...TypeScript
Wagner Mwagnerm.hashnode.dev·Aug 22, 2023The Magic of Discriminated Union Types in TypeScriptThis is a handy Typescript trick! In simple terms, I like to describe this feature as conditional types. This feature allows you to do things like the below ApiResponse type, let the code talk for himself // You can assert the property will have a sp...45 readsTypeScript
Lim Woojaejaylog.hashnode.dev·Jun 5, 2023[TypeScript] Union & Intersection TypeIntroduction In this article, we will be talking about the union and intersection type in TypeScript. Furthermore, I will be talking about the downside of using a union type and introduce generic a little bit. If you want to know more about generics ...Front-endTypeScript
Wendel Fabian Chinsamywendelwritescode.hashnode.dev·Mar 8, 2023Typescript Union TypesIntroduction Typescript union types describe values that can be one of several distinct types. You could imagine an age variable that could be either a number or a string or an acceptTerms variable that could be a boolean or a number. Let's look at a...86 readsTypeScript