react-component / react-component/upload
Typescript: make arguments optional
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 323
- Avg merge
- 12m
- Merged PRs (30d)
- 1
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;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100