New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
My fetch call works fine at runtime, but the response comes back typed as any, so my editor can't suggest a single property on the data.
What you'll have at the end
A typed interface for the fields your card actually uses, plus a small generic fetch helper that applies it, so your editor autocompletes every property and the compiler flags a typo'd or unhandled field before you run the code.
You need
A TypeScript project with strict type checking on, and a working fetch call that already reaches a real JSON endpoint and logs the raw response.
Not covered
Adding a runtime check that verifies every request's shape in production, and handling a response that comes back as an error instead of the data you expected.
Leans on
Narrow an unknown JSON value before you trust it
For adding a runtime guard that checks the live response's real shape on every request, instead of trusting a compile-time assertion alone.
Model an API response so success and failure can't be confused
For an endpoint whose response splits into a success payload or an error object, rather than one shape you can always assert.
Checked 22 Aug 2026
Part of the TypeScript cookbook