Typescript, Generics, Polymorphism.
return { data: null as any, error: error.message }; } } const getUser = async () => { const url = 'https://api.example.com/user'; // Now TypeScript enforces that you must provide a type const result = await fetchData<User>(url); return result.data.name; } If not explicitly provided a type during