DEV Community

Cover image for "I Was Bored, So I Brought Rust Enums to TypeScript" - A Tale of Questionable Life Choices

"I Was Bored, So I Brought Rust Enums to TypeScript" - A Tale of Questionable Life Choices

Ja on October 16, 2024

Hey there, fellow code enthusiasts! Gather 'round as I regale you with the tale of how I, in a fit of what can only be described as "productive pro...
Collapse
 
iannismccluskey profile image
iannismccluskey

You made me laugh out loud in the Paris metro. Thanks a lot. Very inspiring.

Collapse
 
jasuperior profile image
Ja

😜😂 Then I have done my job 😉 Glad I could laugh... mission accomplished

Collapse
 
jonesbeach profile image
Jones Beach

Hahaha this was very fun. And impressive! As a fellow language fan, I'm looking forward to your TypeScript Result type!

Collapse
 
jasuperior profile image
Ja

😜😊❤️ Thanks! and Stay tuned... It will be coming to a theatre near you!

Collapse
 
webbureaucrat profile image
webbureaucrat

Neat!

Have you ever looked into ReScript? It's like the midpoint between Rust and TypeScript. If you're into this sort of thing you might like it.

Collapse
 
jasuperior profile image
Ja • Edited

Ah! yes! Rescript! the OCaml clone that compiles to JS. I've seen it, and I'm a fan of functional languages like those in general. But in the case of Rescript, some of the syntax choices kinda bug me 😅 ( I hate the way they do named arguments for instance). Still tho, I only started doing this to cover a particular need in my application, and it makes more sense to stick with typescript as a compiler. I may have to write about the project i'm doing in the future, but I dont think I want to go all full fp and endo functor the whole project from the ground up, you know (🥁 see what i did there lol).

Plus, its fun exploring new abstractions in new spaces.

Collapse
 
webbureaucrat profile image
webbureaucrat

For sure!

And yeah the named arguments syntax is pretty gross.

Thread Thread
 
wadecodez profile image
Wade Zimmerman

Nah
Image description

Collapse
 
frickingruvin profile image
Doug Wilson

Entertaining while demonstrating several interesting points. Nicely done, sir!

Collapse
 
gahuber95 profile image
Gary Huber

Very cool! Still, I wouldn't share it on a first date...

Collapse
 
aaronngray profile image
Aaron Gray

I was expecting them to be added to the language not constructed in the language.