←PR REVIEWTypeScript `any` Leaking through Generics#310MicrosoftLinear
⏱ 00:00Mid~10 min
PULL REQUEST
Open#310 · 1 commit
TypeScript `any` Leaking through Generics
mid-dev-44 wants to mergechore/api-client-wrapper→main
MI
mid-dev-44
1 file changed · 2 hours ago
YOUR MISSION
A developer created a nice reusable `apiFetch` wrapper. It looks type-safe, but teammates report that if they forget to pass a type parameter, TypeScript silently defaults to `any`, completely disabling type checking for the API response.
Mid~10 min
HINTS (0/3 used)
REVIEWING AS
SR
Senior Engineer
@ Microsoft · Backend Platform
src / utils / api.ts+2−2
1
1
/**
2
2
* A typed wrapper around fetch
3
3
*/
4
−
export async function apiFetch(url: string) {
+
4
+
export async function apiFetch<T = any>(url: string): Promise<T> {