Please help, I am getting this error
src/app/middlewares/authentication.ts:16:17 - error TS2339: Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
16 req.user = user;
I have created the .d.ts file and also included it in tsconfig file. Still I am not able to run this code
Please find attached screenshots



src/
- types/
- express/
- index.d.ts
import express from "express";
declare global {
namespace Express {
interface Request {
user?: Record<string,any>
}
}
}
{
"compilerOptions": {
"typeRoots" : ["./src/types", "./node_modules/@types"]
}
}
Just install types for Passport.js:
npm install -D @types/passport
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With