Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Typescript: make arguments optional

Open
#353 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
api

Research direction

Open interface.d.ts and inspect the onStart, onError, onSuccess, onProgress, and beforeUpload callback declarations. Check the existing TypeScript definitions and usage expectations, then verify that callbacks may omit unused parameters without type errors and that the declarations remain valid.

Written by the indexing model from the issue text.

Description

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;
Dominant language
TypeScript
Stars
804
Forks
323
Avg merge
12m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-component/upload

All issues in react-component/upload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.