DEV Community

Discussion on: Extend Express's Request Object with Typescript Declaration Merging.

Collapse
 
aashishclikfin profile image
aashishClikFin • Edited

First of all thanks a lot for your post, I finally resolved the problem I faced since the last 3 months.

Just would like to add one more bit, since I was using passport alongside passport-jwt hence your solution didn't exactly work for me.

Here is what I used in the index.d.ts file

declare module 'express-serve-static-core' {
export interface Request {
user?: yourCustomType;
}
}

It might help someone else as well, but thanks a lot for guiding me in the right direction.

Collapse
 
itsjinendrajain profile image
Jinendra Jain

Thanks Bro