Why is await response.json() as User unsafe, and what should you do instead?
type User = { id: number; name: string }; async function getUser(id: number) { const response = await fetch(`/api/users/${id}`); return (await response.json()) as User;}The answer
Answer it out loud first, the way you would in the interview. Then compare.
Checking your sign-in…