- Sloth Bytes
- Posts
- 🦥 Why TypeScript Made Me a Better Developer
🦥 Why TypeScript Made Me a Better Developer


Hello friends!
Welcome to this week's Sloth Bytes. I hope you had an interesting week.

Fun fact: This newsletter is made with beehiiv.
The founders of beehiiv were also early employees at Morning Brew and they're bringing the same tools and tech that scaled it into a multi-million dollar business.
With beehiiv, you get:
✅ Growth tools that actually work—referral programs, magic links, and popups to rapidly scale and grow your newsletter.
✅ Revenue made simple—integrated ad networks, paid subscriptions, and passive income through beehiiv Boosts.
✅ An easy-to-use no-code website builder—seriously, you can launch your website in minutes.
Using beehiiv for my newsletter was easily one of my best decisions.
You’re reading the proof right now.
So if you like what you see, give beehiiv a shot. And since you’re a Sloth Bytes reader, you’ll also get 20% off your first 3 months with code SLOTH20.

Why TypeScript Made Me a Better Developer

I didn’t use TypeScript for way too long. (yeah I have no excuse here)
I mean, JavaScript was fine, right? Flexible, dynamic, quick to prototype—who needs strict types and extra boilerplate?
Who needs type safety when you can just write good code.
Well turns out (unsurprisingly) I don’t write good code…
In one of my projects, someone (me) forgot to handle a null value.
That was when I realized: ok maybe dynamic typing isn't always my friend.
Luckily TypeScript is becoming more and more popular which means it’s a good idea as a developer to at least understand the benefits and start using it.
Now if you use statically typed languages (C++, C#, Java, etc), then you already know the benefits.
So…
You can just laugh at these JavaScript nerds.
What is TypeScript?
TypeScript is basically JavaScript with superpowers—it's a strongly typed programming language built on top of JavaScript, adding static types and powerful features that catch mistakes early and help you write cleaner, more robust code.
🧩 Fewer Bugs, Better Sleep
TypeScript introduces static type checking, which catches errors during development instead of runtime. This significantly reduces the number of runtime errors, leading to more stable and predictable software.
Example:

TypeScript checks for any type errors.
🚀 Code Readability and Maintainability
Ever returned to your old JavaScript code and wondered what you were thinking? Me too.
TypeScript forces clarity.
Explicit types and clearly defined interfaces help you and your teammates understand the structure and intent of your codebase immediately. This clarity makes future modifications and debugging far simpler.
Even if you take a break from the codebase, you’ll have a good understanding of what you were doing.
Example:
// Clearly defined and easy to understand
interface User {
name: string;
age: number;
}
// This function makes more sense now
function showUser(user: User) {
console.log(`User: ${user.name}, Age: ${user.age}`);
}
🔧 Improved Development Experience
TypeScript's explicit types improve your IDE's tooling, enabling powerful features like intelligent autocomplete, accurate error detection, and real-time type checking. Coding becomes quicker and less error-prone.
Example (VSCode magic):

🛠️ Easier Collaboration
Working in a team is smoother with explicit types. Everyone is immediately on the same page, reducing misunderstandings and arguments over code structure and usage.
🌟 Real-talk takeaway:
Ok so maybe using TypeScript didn’t just make me a better coder.
It also made coding less stressful and way more enjoyable, so maybe statically type languages aren’t bad (what a surprise…)

Sloth’s produce so much gas when digesting leaves, it helps them float.



Thank you to everyone who submitted! Nice to see more people participating 😁
wirdguy123, FredericoSRamos, jw123450, Kauketz, RelyingEarth87, bakzkndd, GabrielDornelas, HighlandCuwu, in1yan, Raufirzaman, JamesHarryT, FRAIOLIenzo, porrrq, m0sh0, E-Sieben, josericardo-fo, jmadden21, iamansuman, aviral-trivedi, and Franspi-lol.
Lemonade Stand
At a lemonade stand, each lemonade costs $5.
Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bills
).
Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill.
You need to give each customer the right amount of change so that they end up paying $5.
For $5 bills: No change needed
For $10 bills: You need to give $5 back
For $20 bills: You need to give $15 back (best using one $10 and one $5, or three $5 bills)
Return true
if and only if you can provide every customer with correct change.
Examples
lemonade([5, 5, 5, 10, 20])
""" First three customers pay with $5: Now you have three $5 bills
Fourth customer pays $10: You give $5 change, now have two $5 bills and one $10 bill
Fifth customer pays $20: You can give $15 change (one $10 + one $5)
"""
output = True
lemonade([5, 5, 10, 10, 20])
""" First two customers pay with $5: Now you have two $5 bills
Third customer pays $10: You give $5 change, now have one $5 bill and one $10 bill
Fourth customer pays $10: You give $5 change, now have zero $5 bills and two $10 bills
Fifth customer pays $20: You need to give $15 change but you can't because you only have $10 bills!
"""
output = False
lemonade([10, 10])
output = False
lemonade([5, 5, 10])
output = True
Notes
You don't have any change in hand at first.
bills
is an integer array.bills[i]
will be either5
,10
, or20
.
How To Submit Answers
Reply with
A link to your solution (github, twitter, personal blog, portfolio, replit, etc)
or if you’re on the web version leave a comment!
If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

Got sick…
Yeahhhhh got sick and it messed up my voice, so it delayed these 2 videos.
BOTH SHOULD BE DONE THIS WEEK (I HOPE)
That’s all from me!
Have a great week, be safe, make good choices, and have fun coding.
If I made a mistake or you have any questions, feel free to comment below or reply to the email!
See you all next week.
What'd you think of today's email? |
Want to advertise in Sloth Bytes?
If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.
Reply