Modify a type definition file
// Add a new property for the Request interface in Express
declare global {
namespace Express {
interface Request {
currentUser?: UserPayload;
}
}
}
- With this approach it's not needed to use 'extends'