Default export versus named `{ Fetch }` export
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 166
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
This package provides both a default export, which is intended to be the "main" Fetch function as used in the documentation. However, there's also a named { Fetch } export, which is a renamed createRemoteAssetCache. There was some confusion over this; a user wrote { Fetch }, which did not throw an error, but instead mysteriously returned a RemoteAssetCache object even though {type: 'json'} was passed.
My guess is that this was done for backwards compatibility, but it is confusing for developers nevertheless, especially because the docs isn't very up-front about this. It shows the default import only, sure, but it is an easy mistake to add the curlies, and the lack of an immediate error makes it easy to miss.
For the next major release I would suggest renaming the exports; either do not export a named { Fetch } at all, or have it be an alias to the default export; the createRemoteAssetCache function can be exported under its own name.
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
Start at the package's export entry point and inspect how the default Fetch, named Fetch, and createRemoteAssetCache exports are defined. Review the documentation's import examples and determine which export API should be adopted for the next major release. Done means the export naming decision is agreed, the confusing alias is addressed, and the documentation clearly distinguishes the imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100