TypeScript’s Numeric Enums and Their Not-so-obvious Interplay with the typeof and keyof OperatorsIf you are like me, you once fully understood TypeScript’s enums in all their details (or believed you did), but after not working with…Oct 14Oct 14
"No more manually typing out every single value." is not true since you defineconst fruits = ["apple", "banana", "orange", "mango"] as const;Oct 1Oct 1
TypeScript: It’s getting unpredictable if you hit the language’s “design limits”If you hit the limits of TS’s inference capabilities it doesn’t necessarily react — as you would hope for — with a graceful degradation…Nov 1, 2021Nov 1, 2021
Hi Gregory,Thanks for your comment. I think you mistook a bit what the TuplifyUnion type does: Instead of delivering all permutations of the tuple…Oct 22, 2021Oct 22, 2021
TypeScript: Constructing a Permutation typeWe create a generic type that takes a tuple type as a parameter and returns the union of all permutations of the tuple element typesOct 22, 2021Oct 22, 2021
Tuple-Union conversions in TypeScriptA supplement to Array Metaprogramming in TypeScript: A fourth method to convert a union into a tuple typeOct 6, 20211Oct 6, 20211
More TypeScript quirks: double standards for propagating type informationYou might suspect that for type ObjType = {v: ..., x: ...} the two variables const v1: ObjType = {v: ..., x: ...}; and const v2 = {...v1…Sep 28, 2021Sep 28, 2021
Warning of some surprising quirks and “design limitations” in TypeScriptIf you use conditional types, be aware of some surprising limitations of TS’s inference capabilities, as e.g. encountering an undocumented…Sep 12, 2021Sep 12, 2021
Extension of Constraining TypeScript’s type parameters to “ground” instantiations: Accepting also…This is an extension of How to constrain in TypeScript type parameters to “ground” instantiations of union types or its simplification…Aug 4, 2021Aug 4, 2021
Simplification of constraining TypeScript’s type parameters to “ground” instantiationsThis is a simplification of my code suggested in How to constrain in TypeScript type parameters to “ground” instantiations of union typesAug 4, 2021Aug 4, 2021