What is the appropriate way to cast my data to the correct return types of Next APIs?
Currently, I have:
import { GET } from '@/app/api/todos/route';
async function MyPage() {
const data: Awaited<ReturnType<typeof GET>> = await fetch('http://localhost:3000/api/todos').then((r) => r.json());
return <> </>
}
This is close, but data ends up as:
const data: NextResponse<{
id: number;
name: string;
}[]>
This isn't iterable. How would I unwrap the NextResponse part of it?