title: ExpressJs with TypeScript - passing data between middlewares
body: <p>I'm writing my first expressJs app using TypeScript. I got got static middleware method for token validation, where I need pass data to the next middleware:</p>
  <pre><code>    static verifyAccessToken(req: Request, resp: Response, next: NextFunction) {
          const AUTH_TOKEN = AccessTokenValidator.getTokenFromHeader(req, resp);
  
          jwt.verify(AUTH_TOKEN, Config.JWT_SECRET, async (error: VerifyErrors | null, payload: any) =&gt; {
              if (error) {
                  resp.status(401).send({message: &quot;Token is invalid&quot;});
              }
              // @ts-ignore
              req.userRole = payload.rol;
              next();
          });
      }
  </code></pre>
  <p>How can I pass data to next middleware correctly, without using &quot;@ts-ignore&quot;?</p>