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

Use community provided types for graphql-upload #2844

Merged
merged 13 commits into from
Jul 30, 2019
Merged

Use community provided types for graphql-upload #2844

merged 13 commits into from
Jul 30, 2019

Conversation

denkristoffer
Copy link
Contributor

Hi 👋

apollo-server is currently bundling its own incomplete type definition for graphql-upload. This PR moves to the @types/graphql-upload package instead.

@denkristoffer
Copy link
Contributor Author

Tests seem to be failing because processRequest no longer types request and response as any, which breaks apollo-server-fastify and apollo-server-hapi.

I'm not sure how to proceed other than typing as any. Is anyone stronger than me in TypeScript able to help?

@abernix
Copy link
Member

abernix commented Jun 19, 2019

Thanks for submitting the pull request. Someone will need to look into this more to figure out exactly what the issue may be, as we'd want to avoid typing those as any, I believe.

abernix added 7 commits July 24, 2019 17:46
…essage`.

While currently we use `OutgoingMessage`, it actually seems to be suggested
that `ServerResonse` — which is an extension of `OutgoingMessage`:

https://github.com/fastify/fastify/blob/master/docs/TypeScript.md#example

Helps-to-land: #2844
The immediately pressing reason is to align on the same types that the
`processRequest` method from `graphql-upload` (aliased here as `processFileUploads`) uses.

Using the raw types should be fine as `graphql-upload` only binds to
the `response` to receive "close"-like `EventEmitter` events, and uses the
`request` side for the piping of data, which should be identical to Hapi's
abstraction.

Helps-to-land: #2844
This reverts commit 829f22a.

While this was once necessary, it should no longer be with the changes in
8e49b28 and 7638f64.
Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a couple follow-up commits that I believe are the correct adjustments for the typing errors you encountered. I do believe that IncomingMessage (which extends stream.Readable) and ServerResponse (which extends stream.Writeable) from @types/node are both types to rally around!

@abernix abernix merged commit e6462c8 into apollographql:master Jul 30, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants