I try to building an mini Async Task Retry logic. The goal was to simulate a flaky network request and build a wrapper function that automatically retries the request if it fails, instead of just breaking. What I practiced and learned: Generics with Promises: I used TypeScript's built-in generics by defining Promise<ApiResponse> for both the simulator function and the retry wrapper. This ensured both functions knew exactly what shape of data to expect on success. Function Types: I learned how to strongly type a function parameter. I defined my input as apiCallFunc: () => Promise<ApiResponse> so the compiler knows exactly what the passed function will return. later added 3 emojis to make terminal output more readable, 🟢🔴⏳ fun :) #TypeScript #AsyncProgramming #WebDev #LearningInPublic #StudentDeveloper

To view or add a comment, sign in

Explore content categories