Hi,
Is it possible to import the Multer.File interface from @types/multer d.ts file ?
I was unable to import it directly with import { File } from 'multer';.
Is there something I'm missing ?
Thanks.
It should be available via the global namespace Express.Multer.File.
Was able to reach it with importing the express namespace first
import { Express } from 'express';
let multerFile: Express.Multer.File;
@BendingBender Thanks for the help.
Didn't notices that Multer is under the Express namespace.
Is there any particular reason for this to be declared in an Express namespace?
I needed to do the following to use a multer File type
import 'multer';
const multer = require('multer');
let multerFile: Express.Multer.File;
A bit ridiculous....
import multer = require('multer');
So you can't just use Multer.File globally? Why?
So you can't just use
Multer.Fileglobally? Why?
I just used:
interface Request {
media: Express.Multer.File;
ticket: Ticket;
}
Without importing express first.. So maybe its available globally.
I have a tricky question about why VsCode tell me that Express is never read and I currently use Express.Multer.File, how can I solve it? 馃


UPDATE
I found the solution, I note that Express is a global variable then I set it on globals key of Eslint and after that, I don't need to import Express anymore I just use it on my code like Express.Multer.File. 馃槃
Most helpful comment
I needed to do the following to use a multer File type
A bit ridiculous....