Skip to content

Typescript: make arguments optional #353

Description

@nat-davydova

In interface.d.ts in these methods all the arguments are required:

onStart?: (file: RcFile) => void;
onError?: (error: Error, ret: object, file: RcFile) => void;
onSuccess?: (response: object, file: RcFile, xhr: object) => void;
onProgress?: (event: UploadProgressEvent, file: RcFile) => void;
beforeUpload?: (file: RcFile, FileList: RcFile[]) => BeforeUploadFileType | Promise<void | BeforeUploadFileType>;

But in my code I might be not interested in file argument, for example. While all args are required I must still define them and get TS errors for defined and not used variables.

Could you please make these args optional like this:

onSuccess?: (response?: object, file?: RcFile, xhr?: object) => void;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions