Solución
solution.tsTypeScript
interface ApiResponse {
data: string;
status: number;
ok: boolean;
}
export function isApiResponse(val: unknown): val is ApiResponse {
if (typeof val !== "object" || val === null) {
return false
}
return (
typeof val.data === "string" &&
typeof val.status === "number" &&
typeof val.ok === "boolean"
)
}0respuestas