fix(plugin-npm): mark fetchFromNetwork private to fix TypeScript issue #6764
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
As part of developing a Yarn plugin for our project, we introduced
@yarnpkg/plugin-npm
as a dependency. However when running typescript, the package raises the following error:I've looked at the generated
lib/NpmHttpFetcher.d.ts
file https://www.npmjs.com/package/@yarnpkg/plugin-npm?activeTab=code, I found that the issue was in thefetchFromNetwork
signature which includes a path generated during CI (/home/runner/work/berry/berry/...
), which cannot be resolved locally.How did you fix it?
As the
fetchFromNetwork
method seems to be intended for local use only, I've marked it as private so that TypeScript skips inferring the return type, marking the change as minor. But please let me know if you would prefer to keep the method public and explicitly define the return type.I've spotted a similar error in:
berry/packages/plugin-github/sources/GithubFetcher.ts
Line 39 in 1908ee7
berry/packages/plugin-http/sources/TarballHttpFetcher.ts
Line 34 in 1908ee7
happy to fix those as well.
Checklist