Search code examples
node.jstypescriptexpressmulter

Anyone knows about this Namespace 'global.Express' has no member 'Multer' exported.ts(2694)


Im trying to create an enpoint to send a zip file and this error keeps apearing ERROR in ./apps/api/src/app/ingestion/ingestion.controller.ts:46:35 TS2694: Namespace 'global.Express' has no exported member 'Multer'.

My app is develop in Typescript.

Anyone knows how to solve it?

I tried some solutions that Chatgp gave me


Solution

  • Solved, you have to import in your tsconfig.json this lines

    "types": ["node", "Multer"], 
    

    because Multer wasn't imported in the express environment. Here is the example

    {
      "extends": "./tsconfig.json", 
      "compilerOptions": {
        "outDir": "../../dist/out-tsc", "module": "commonjs",
        "types": ["node", "Multer"],
        "emitDecoratorMetadata": true,
        "target": "es2015"
       },
       "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
       "include": ["src/**/*.ts"]
    }