#JWT callback types

1 messages · Page 1 of 1 (latest)

floral pollen
#

Hello, I'm not sure and I can't find anywhere what are the types for the callback function of jwt, is it supposed to be custom type made by me or a type from jsonwebtoken

jwt.verify(token, process.env.JWT_SECRET as string, (err: any, user: any) => {
  if (err) {
    return res.sendStatus(403);
  }

  req.user = user;
  next();
});
worn raft
#

types are available through @types/jsonwebtoken

floral pollen
#

is there a resource you could forward me to?

worn raft
#

it'll already be typed if you just install the types for the package

#

you dont need to annotate it yourself

floral pollen
#

I have them installed as a dev dependency but if I run the code without : any it doesn't compile