Content pfp
Content
@
0 reply
0 recast
0 reaction

typeof.eth 🔵 pfp
typeof.eth 🔵
@typeof.eth
Recently got turned onto ts-pattern. It's a pattern matching library, and it's _really_ nice for doing inline conditional rendering in React code. Ngl, I would mostly use IIFEs before this. Sorry not sorry. But hey, I have a better alternative now. https://github.com/gvergnaud/ts-pattern
2 replies
0 recast
2 reactions

Phil Cockfield pfp
Phil Cockfield
@pjc
"sorry, not sorry" - that's a great expression (adding to toolbox). Super interesting library, checking it out now - thanks Dan.
2 replies
0 recast
1 reaction

Phil Cockfield pfp
Phil Cockfield
@pjc
I'll report back when I get my head around it...but damn I do like Union Types . I've done a ton of firing things that have a { type: ... } property through observables and being able to filter them down and get the strong typed match out is POWER city.
0 reply
0 recast
1 reaction

typeof.eth 🔵 pfp
typeof.eth 🔵
@typeof.eth
Curious to get your thoughts on it! For me, pattern matching felt super natural right way. I definitely prefer the interface of this library over the syntax that's being proposed over here: https://github.com/tc39/proposal-pattern-matching Not gonna complain when we get pattern matching as a core JS feature, though.
0 reply
0 recast
0 reaction