Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript: make arguments optional #353

Open
nat-davydova opened this issue Oct 25, 2021 · 0 comments
Open

Typescript: make arguments optional #353

nat-davydova opened this issue Oct 25, 2021 · 0 comments

Comments

@nat-davydova
Copy link

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant