Open tom-saetran opened 3 years ago
Params types incomplete, folder does not exist in type "Params".
Steps to reproduce
import { v2 as cloudinary } from "cloudinary" const cloudinaryStorage = new CloudinaryStorage({ cloudinary, params: { folder: "folderName" } })
Results in:
"Type '{ folder: string; }' is not assignable to type 'Params | undefined'. Object literal may only specify known properties, and 'folder' does not exist in type 'Params'."
Multer-Storage-Cloudinary - 4.0.0 Node - v14.17.4 NPM - 7.20.0
Hello Tom! Till they fix it, you may work around it. I first import Options from multer-storage-cloudinary and then extended it like the following.
import { Options } from "multer-storage-cloudinary";
declare interface cloudinaryOptions extends Options { params: { folder: string } }
const multerOpts: cloudinaryOptions = { cloudinary: cloudinary, params: { folder: "Profile", }, };
const storage = new CloudinaryStorage(multerOpts);
Params types incomplete, folder does not exist in type "Params".
Steps to reproduce
Results in:
"Type '{ folder: string; }' is not assignable to type 'Params | undefined'. Object literal may only specify known properties, and 'folder' does not exist in type 'Params'."
Screenshot
Multer-Storage-Cloudinary - 4.0.0 Node - v14.17.4 NPM - 7.20.0