Interview practice question
Typing a generic fetch helper
Frontend Engineering · TypeScript · Intermediate
How would you write a typed helper function for fetching JSON from your API?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Generic return Promise<T>.
- Optionally take a schema to validate and infer.
- Handle errors with typed error objects.
- Avoid unsafe casting without validation.
- Typed endpoints map.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.