The most used, flexible, fast and streaming parser for multipart form data. Supports uploading to serverless environments, AWS S3, Azure, GCP or the filesystem. Used in production.
MIT License
7k
stars
680
forks
source link
TS Options Type Definition missing createDirsFromUploads #951
Argument of type '{ filename: (_name: string, _ext: string, part: Part) => string; createDirsFromUploads: boolean; }' is not assignable to parameter of type 'Options'.
Object literal may only specify known properties, and 'createDirsFromUploads' does not exist in type 'Options'.ts(2345)
What result did you expect?
createDirsFromUploads should exist on type Options in order to be able to override option in a type safe way.
Current Workaround
Type coercion to unknown as follows
const form = formidable({
filename: (_name, _ext, part) => `${Date.now()}/${part.originalFilename}`,
createDirsFromUploads: true,
} as unknown);
this silences the ts error without also causing the no-explicit-type-any eslint errors
Support plan
Context
What are you trying to achieve or the steps to reproduce?
What was the result you got?
What result did you expect?
createDirsFromUploads should exist on type Options in order to be able to override option in a type safe way.
Current Workaround
Type coercion to
unknown
as followsthis silences the ts error without also causing the
no-explicit-type-any
eslint errors