I keep getting Property 'json' does not exist on type 'Response'..
I've checked the whole internet about that issue, but I could only find a post here without a good answer. Response only seems to have .headers That's very annoying. Maybe I did something wrong with tsconfig?
async function fetchApi(url: string) {
const response = await fetch(url);
const result = await response.json();
if (!response.ok) throw result;
return result;
}
{
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"verbatimModuleSyntax": true,
"isolatedModules": true
},
"exclude": ["./drizzle.config.ts"]
}