anacronw/multer-s3

Type issue with multer-s3 3.0.1 and @aws-sdk/client-s3

Arteneko opened this issue · 2 comments

Following the example in the README, using S3 instead of S3Client, I obtain this error of missing parameters...

Type 'S3' is missing the following properties from type 'S3': getBucketLifecycle, getBucketNotification, putBucketLifecycle, putBucketNotification, and 11 more.ts(2740)
index.d.ts(13, 5): The expected type comes from property 's3' which is declared here on type 'Options'
import multers3 from 'multer-s3';
import { S3 } from '@aws-sdk/client-s3';

const s3 = new S3({});
return {
	storage: multers3({
		s3,
		contentType: multers3.AUTO_CONTENT_TYPE,
		bucket: config.get<string>('S3_BUCKET'),
		key: function (req, file, cb) {},
	}),
};

Since I had to change S3Config to S3 (as S3config had many more errors), is there anything else I'm missing?

Edit: I just noticed the typings for multer-s3 seems to be out of date, as they still target multer-s3 v2...

// Type definitions for multer-s3 2.7

Using the AWS SDK v2 with multer v3.0.1 and the current typings correct the error, but obviously breaks the code

This package doesn't ship with types, so you'll have to file an issue at DefinitelyTyped instead