Error in using expressMiddleware

Hi
in this code I tried to use middleWare in express typescript
but when I type:
app.use(‘/graphql’, expressMiddleware(server));
I receive this error:
" No overload matches this call.
The last overload gave the following error.
Argument of type ‘RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>’ is not assignable to parameter of type ‘Application<Record<string, any>>’.
Type ‘RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>’ is missing the following properties from type ‘Application<Record<string, any>>’: init, defaultConfiguration, engine, set, and 63 more.ts(2769)
index.d.ts(168, 5): The last overload is declared here."

this is my code:
import { ApolloServer } from ‘@apollo/server’;
import { expressMiddleware } from ‘@apollo/server/express4’;
import { ApolloServerPluginDrainHttpServer } from ‘@apollo/server/plugin/drainHttpServer’;
import express from ‘express’;
import http from ‘http’;
import cors from ‘cors’;
import { typeDefs, resolvers } from ‘./graphql’;
import { Database } from ‘…/lib/types’;
interface MyContext {
token?: string;
db?: Database;
}

const app = express();
const httpServer = http.createServer(app);
const server = new ApolloServer({
typeDefs,
resolvers,
plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
});

await server.start();
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.use(‘/graphql’, expressMiddleware(server)); //causes error

await new Promise((resolve) => httpServer.listen({ port: 4000 }, resolve));
console.log(🚀 Server ready at http://localhost:4000/);

We have the same issue when using the example in Get Started page. “typescript”: “^5.8.2”, tsconfig:

{
  "compilerOptions": {
    "rootDirs": ["src"],
    "outDir": "dist",
    "lib": ["es2020"],
    "target": "es2020",
    "module": "esnext",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "types": ["node"]
  }
}

In the past, when I received an error similar to this, it was because I was not passing the context (interface and object) to Apollo Server.