react-dropzone / react-dropzone/attr-accept
More specific type for acceptedFiles param
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 120
- Forks
- 23
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 7
Description
Small suggestion to improve the type of the acceptedFiles param.
In my project I use:
type NonEmptyArray<T = unknown> = [T, ...T[]];
type UniqueFileTypeSpecifier = `${string}/${string}` | `.${string}`;
type AcceptedFiles = UniqueFileTypeSpecifier | NonEmptyArray<UniqueFileTypeSpecifier>
Not perfect but it does at least give some indicator. I don't use the comma-separated feature but my type should also allow that.
Contributor guide
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
Start at src/index.js line 8, where the acceptedFiles parameter is defined. Review how the parameter currently accepts single and comma-separated file type values, then check the project's existing type-checking or test setup. Done means the parameter type communicates the supported formats, including the comma-separated form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100