To correctly format this, referring to the TypeScript definition from here:
interface Request<
P = core.ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = core.Query,
Locals extends Record<string, any> = Record<string, any>
> extends core.Request<P, ResBody, ReqBody, ReqQuery, Locals> {}
The correct way to define the Request types is by specifying them inside the brackets like so:
interface ILoginInfo {
username: string;
password: number;
}
const loginUser = async (req: Request<any, Response, ILoginInfo>, res: Response): Promise<void> => {
const { username, password } = req.body;
}