Interview practice question
Typing a higher-order function that wraps any function
Frontend Engineering · TypeScript · Experienced
How would you type a withRetry wrapper that takes any async function and returns a function with the same parameters and return type?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Generic over function type or args/return.
- Parameters<F>, ReturnType<F>/Awaited.
- Preserve this if needed.
- Variadic tuple generics.
- Test inference.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.