TS1099

Type argument list cannot be empty.

Broken Code ❌

const result = await response.json<>();

This error occurs because TypeScript does not allow empty type argument lists (<>).

Fixed Code ✔️

The method response.json() does not expect generic parameters to be provided. You don't need to provide any generic type parameters. Simply remove the empty type argument list (<>) from the method call:

const result = await response.json();

If you want to strongly type the result, you can cast it using as:

interface MyResponse {
  data: string;
}
 
const result = (await response.json()) as MyResponse;
console.log(result.data);