How do I get Next.js middleware response with TypeScript?

I followed the documentation (Next.js Middleware on Netlify | Netlify Docs) but new MiddlewareRequest() is not accepting nextRequest because Type 'NextRequest' is not assignable to type '{ readonly geo: { timezone?: string | undefined; }; }'.

Perhaps there’s a change in types? I tried this with next 13.0.6 and also with the highest version of next 12, (I think 12.3.4?)

import type { NextRequest } from "next/server";
import { MiddlewareRequest } from "@netlify/next";

export async function middleware(nextRequest: NextRequest) {
  const request = new MiddlewareRequest(nextRequest); 
  const response = await;
  return response;

Hi @mikec — please could you check you’re on the latest version of the Netlify CLI?

In your terminal, use netlify --version.

The latest version at the time of writing this is 12.2.9.

If you’re not up to date, run npm update netlify-cli -g.

Just updated to 12.2.10 but still have the same issue. Think I saw @ascorbic say this was being updated very soon though!

Hey @mikec,

Sorry for the delay. Could you please share this in a repository for us to test? The fix that you mentioned being worked on, was a mistake. Matt Kane meant to send that response somewhere else and sent it here (which is why he deleted it later). So, it might not be the fix you’re waiting for.

If you can share this as a repo, we can investigate it and pass it to the devs to fix, if it’s a bug.