title: controller.ts(8,8): error TS2339: Property 'user' does not exist on type 'Request' while extending express.Request
body: <p>I am getting below error. Please help me.</p>
  
  <pre><code>controller.ts(8,8): error TS2339: Property 'user' does not exist on type 'Request'.
  </code></pre>
  
  <h1>controller.ts</h1>
  
  <pre><code>import * as express from 'express';
  class Users{
   public showUser(
      req: express.Request,
      res: express.Response,
      next: express.NextFunction
    ) {
       return req.user;
  
   }
  }
  const users = new Users();
  export = {
   showUser: users.showUser
  }
  </code></pre>
  
  <h1>express.custommerge.d.ts</h1>
  
  <pre><code>// Extend the Express interface with declaration merging
  import { User } from './api';
  declare namespace Express {
    export interface Request {
      user: User; 
    }
  }
  </code></pre>
  
  <h1>api.ts</h1>
  
  <pre><code>export class User {
   'userId': string
  }
  </code></pre>
  
  <h1>Note:</h1>
  
  <p>This is error does not come if i don't include <code>import { User } from './api';</code> in express.custommerge.d.ts with adding <code>any</code> instead of <code>User</code></p>