@types/express package and had problems.Definitions by: in index.d.ts) so they can respond.Typescript version: 2.6.1
express: 4.16.2
types/express: 4.0.39
When trying:
function(req: Request, res: Response, next: Next) {
console.log(req.user);
}
Because it doesn't exist in express request object. What is the problem here?
@sandcake you try to access req.user, I guess you are using express with passport? If so, you should install @types/passport too.
@19majkel94 that's confusing because the user field is shown in the autocompletion (using vscode 1.18.1).
Furthermore the error just started popping for a few days after being silent for almost a year.
I don't get it - typescript complain that the property user doesn't exist but typescript provide autocompletion for it? Looks like VSCode bug, not @types/express 馃槈
I think you are right @19majkel94 , i just checked today after a fresh restart and fresh install and can't reproduce it anymore.
I shall then close this issue.
@micksatana that's right, i am using express with passport. Thanks for the tip :) . I shall try it when the error occurs again.
Most helpful comment
@sandcake you try to access
req.user, I guess you are usingexpresswithpassport? If so, you should install@types/passporttoo.