Jake Carpenter @jakecarpenter.dev · Nov 17

I'll still take pattern matching over this any day. Easier to read, _and_ I can account for conditions that aren't mutually exclusive. Languages with pattern matching support make it terser, but here's TypeScript w/ ts-pattern.

2 likes 1 replies

?

Replies

ivy · Nov 17

Your example is definitely more standard. I got used to ternary chains in C#->EF where we needed to provide an expression for it to be evaluated as SQL on the server side. Pattern matching is a close second for me, but I still like that the ternary chain is like 1/4 the syntax as patterns