I am getting typescript errors when using the verifySession() middleware in express.
This line (as found in the documentation when explaining verifySession()):
app.post("/test", verifySession(), async (req: SessionRequest, res: express.Response) => {
})
is giving me the following error:
No overload matches this call.
The last overload gave the following error.
Argument of type '(req: SessionRequest, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Type '(req: SessionRequest, res: Response<any, Record<string, any>>, next: NextFunction) => Promise<void>' is not assignable to type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Types of parameters 'req' and 'req' are incompatible.
Type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to type 'SessionRequest'.
Types of property 'session' are incompatible.
Type 'Session & Partial<SessionData>' is not assignable to type 'SessionContainerInterface | undefined'.ts(2769)
These are my imports:
import express, { Response } from "express";
import {SessionRequest} from "supertokens-node/framework/express";
import { verifySession } from "supertokens-node/recipe/session/framework/express";