Skip to content
0:00 / 0:00

#effect-ts#typescript#async-await

Why I Stopped Using Async/Await in TypeScript: An Introduction to Effect

Lucas Barake

7K subscribers • 1 video on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • May be out of date. The tools, versions or practices it shows have likely moved on.
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

11K views2 years ago2 recommendations

Programming languagesWeb developmentTypeScriptFunctional programmingConcurrency and parallelism

Lucas Barake introduces the Effect library in TypeScript as an alternative to async/await for better type safety and error handling.

Async/await has been a game-changer for JavaScript, revolutionizing the way we handle asynchronous operations and making our code more readable and maintainable. However, as powerful as it is, async/await has its limitations, especially when it comes to type safety and error handling in TypeScript. In this video, I explore an alternative approach that not only addresses these shortcomings but also takes asynchronous programming in TypeScript to the next level. Throughout this video, I dive deep into the concepts behind Effect, demonstrate its practical application through real-world examples, and show you how to leverage its powerful features to ensure type safety, improve error handling, and write more maintainable asynchronous code. Theme: Dim Night The Problem with Async TypeScript Refactoring to use Effect Instead Running Effects Handling Errors in Effect (Tagged Errors) Runtime Validation: Introduction to @effect/schema Streamlining Conditionals with Effect.filter Why You Shouldn't Type Errors Explicitly Using Identity Functions to Enforce Success Types Effect's Ecosystem Is Optional, But You Should Still Check It Out Simplifying Requests with Effect's HttpClient tap, andThen, map, and flatMap

Why it's here

2 people recommend this

What people say. Recommended as an introduction to using the Effect library in TypeScript to handle asynchronous operations with better type safety.

u/Gwolf4in r/ExperiencedDevs • Recommends

On “Language suggestions for an API”

If you really want to experiment. Pick effects ts link to this video it is a library to apply some goodies constructs from more strict functional languages. The best of the library framework is that it helps you get closer to type check some things at type level. Past are the days of coloring a function with async and await it. At type level you can now if something is async, if something may return null, which is not the same as having union types of null | data.  I have seen some crazy claims of people ditching redux and react query on the front end using that, and people using directly the nodejs raw http server with that library alone. I haven't personally tested it. But as someone that would li…

u/dim-namein r/typescript • Recommends

Why I Stopped Using Async/Await in TypeScript: An Introduction to Effect