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

Misleading type mentioned for 'formatResponse' in the docs #4186

Closed
asif-ir opened this issue May 30, 2020 · 2 comments
Closed

Misleading type mentioned for 'formatResponse' in the docs #4186

asif-ir opened this issue May 30, 2020 · 2 comments
Labels
📝 documentation Focuses on changes to the documentation (docs)

Comments

@asif-ir
Copy link

asif-ir commented May 30, 2020

The type for formatResponse option is wrongly mentioned as Function though it is declared differently as (response: GraphQLResponse | null, requestContext: GraphQLRequestContext<TContext>) => GraphQLResponse in the code.

Docs Reference: https://github.com/apollographql/apollo-server/blob/master/docs/source/api/apollo-server.md#parameters

Code Reference:

(Note: This change was actually introduced in this commit.)

@abernix abernix added the 📝 documentation Focuses on changes to the documentation (docs) label Dec 31, 2020
@dgurns
Copy link

dgurns commented Jan 7, 2021

Same issue here. Unless I'm misunderstanding something, looks like the formatResponse function type should allow returning GraphQLResponse | null.

Current:

formatResponse?: (
    response: GraphQLResponse | null,
    requestContext: GraphQLRequestContext<TContext>,
  ) => GraphQLResponse

Probably should be:

formatResponse?: (
    response: GraphQLResponse | null,
    requestContext: GraphQLRequestContext<TContext>,
  ) => GraphQLResponse | null

@glasser
Copy link
Member

glasser commented Apr 6, 2021

@asif-ir In general our API docs just say Function for any function type; if you need the more precise type, the TypeScript definitions are canonical.

@dgurns You're right that the typing looks wrong. Fixing in #5089.

@glasser glasser closed this as completed Apr 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📝 documentation Focuses on changes to the documentation (docs)
Projects
None yet
Development

No branches or pull requests

4 participants