Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @types/node-fetch to apollo-env deps since they are exported #1749

Merged
merged 2 commits into from
Jan 9, 2020

Conversation

trevor-scheer
Copy link
Member

@trevor-scheer trevor-scheer commented Jan 8, 2020

This PR is in response to apollographql/apollo-server#3580. Currently, dependents of apollo-env can expect TS build errors if @types/node-fetch isn't included transitively. This affects the entire apollo-server-* family via apollo-server-core, as seen in this dependency tree:

[email protected]
└─┬ [email protected]
  └─┬ [email protected]
    ├─┬ @apollographql/[email protected]
    │ └── [email protected] 
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected]  deduped

The build error when trying to install apollo-server-express in a typescript project:

% npx tsc
node_modules/apollo-env/lib/fetch/fetch.d.ts:6:195 - error TS7016: Could not find a declaration file for module 'node-fetch'. '/Users/trevorscheer/Desktop/example/node_modules/node-fetch/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/node-fetch` if it exists or add a new declaration (.d.ts) file containing `declare module 'node-fetch';`

6 export { default as fetch, Request, Response, Headers, ResponseInit, BodyInit, RequestInfo, HeadersInit, Body, RequestInit, RequestMode, RequestCredentials, RequestCache, RequestRedirect } from "node-fetch";

Exporting these^ from the root of apollo-env like this requires that apollo-env should list the @types/node-fetch as a project dependency.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants