multer-storage-cloudinary icon indicating copy to clipboard operation
multer-storage-cloudinary copied to clipboard

Params types incomplete, folder does not exist in type "Params".

Open tom-saetran opened this issue 3 years ago • 1 comments

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'."

Screenshot

Multer-Storage-Cloudinary - 4.0.0 Node - v14.17.4 NPM - 7.20.0

tom-saetran avatar Aug 18 '21 19:08 tom-saetran

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'."

Screenshot

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);

hasibu369 avatar Sep 20 '21 08:09 hasibu369