I'm trying to not use the any
type when creating a GET handler with the new Next.js 13 experimental routing API.
Here is my code:
export async function GET(request: any, {params}: any) {
function getRandomInt(min: number, max: number) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive
}
const youTubeId = params.id;
I've tried HttpWebResponse
but it doesn't help.
Request
andResponse
are globally available. its type will be inferred asfunction GET(request: Request): Promise<Response>
or you could use
NextResponse
and its type will be inferred as
function GET(request: Request): Promise<NextResponse>