title: Using multer diskStorage with Typescript
body: <p>I'm translating a node.js server to typescript.</p>
  
  <p>My funcion with node is:</p>
  
  <pre><code>const storage = multer.diskStorage({
      destination: function (req, file, cb) {
          const dir = './uploads/';
          mkdirp(dir, err =&gt; cb(err, dir));
      },
      filename: function (req, file, cb) {
          cb(null, file.originalname)
      }
  });
  
  const upload = multer({
      storage: storage
  });
  
  router.post('/test', upload.fields({name: 'image'}), async function (req, res, next) {
  ...
  });
  </code></pre>
  
  <p>But I have a lot of errors. For example I can't set the file argument as Express.File type, 'memoryStorage' does not accept arguments or mkdirp tells me that is not callable.</p>