-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Currently, the formidable-serverless
package does not include TypeScript type definitions, and there are no type declarations available via @types/formidable-serverless
. This makes it difficult for TypeScript users to use the package without manually creating custom declaration files.
Adding built-in type definitions or publishing a corresponding @types
package would significantly enhance the developer experience.
Example: formidable-serverless.d.ts
declare module 'formidable-serverless' {
import { IncomingMessage } from 'http';
type Fields = { [key: string]: string | string[] };
type Files = { [key: string]: any };
interface Options {
multiples?: boolean;
uploadDir?: string;
keepExtensions?: boolean;
maxFileSize?: number;
maxFieldsSize?: number;
maxFields?: number;
hash?: boolean | 'sha1' | 'md5';
fileWriteStreamHandler?: any;
}
export class IncomingForm {
constructor(options?: Options);
parse(
req: IncomingMessage,
callback: (err: Error | null, fields: Fields, files: Files) => void
): void;
on(event: 'field', listener: (name: string, value: string) => void): this;
on(event: 'file', listener: (name: string, file: any) => void): this;
on(event: 'end', listener: () => void): this;
on(event: 'error', listener: (err: Error) => void): this;
// Add other event listeners if needed
}
export default IncomingForm;
}
Metadata
Metadata
Assignees
Labels
No labels