apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Add @types/node as dependency to apollo-server-core

Open Methuselah96 opened this issue 3 years ago • 1 comments
trafficstars

The apollo-server-core package references Node types and should therefore have a dependency on @types/node. Here are the errors I am getting using Yarn PnP:

../../.yarn/__virtual__/apollo-server-core-virtual-983f73c0e4/0/cache/apollo-server-core-npm-3.5.0-874d4d1222-4640428267.zip/node_modules/apollo-server-core/dist/nodeHttpToRequest.d.ts:1:23 - error TS2688: Cannot find type definition file for 'node'.

1 /// <reference types="node" />
                        ~~~~

../../.yarn/__virtual__/apollo-server-core-virtual-983f73c0e4/0/cache/apollo-server-core-npm-3.5.0-874d4d1222-4640428267.zip/node_modules/apollo-server-core/dist/plugin/drainHttpServer/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'node'.

1 /// <reference types="node" />
                        ~~~~


Found 2 errors.

Methuselah96 avatar Dec 05 '21 03:12 Methuselah96

@Methuselah96: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

apollo-cla avatar Dec 05 '21 03:12 apollo-cla

Sorry we never addressed this @Methuselah96. If this is still a problem in AS4 I'd be interested to see a reproduction of the issue you've described. It seems pretty atypical to include @types/node as a package dependency.

trevor-scheer avatar Oct 19 '22 00:10 trevor-scheer

The files in question have moved around, but it does look like the drain server plugin's DTS file still has the <reference line. That said, I think it's typical that people building Node apps install @types/node themselves? Our new TS-based tutorial tells folks to install @types/node... Maybe we should do something about this.

It feels like this is more of a peer dep situation than a direct dep situation though... shouldn't the user be able to easily select the major version of @types/node?

glasser avatar Oct 19 '22 00:10 glasser