-
Notifications
You must be signed in to change notification settings - Fork 2k
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
formatResponse typings: null response? #5009
Comments
glasser
added a commit
that referenced
this issue
Apr 6, 2021
I've released a prerelease with this fix, version |
This is released in Apollo Server 2.23.0. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In #3431, the typings for
formatResponse
were set such that theresponse
argument could benull
. However, this causes problems when trying to write a basic implementation that, for instance, adds a property to the object:This produces a TypeScript error, as
response
is typed asGraphQLResponse | null
but the expected return type is justGraphQLResponse
(non-nullable):It's not clear to me if
response
ever actually can be null here, but I would expect this function to be typed such that theresponse
argument and the return value have the same type. Ifresponse
will not ever be null, I'd like the types to reflect that.This is mentioned in a comment on #4186, though I don't think that's actually the issue that OP encountered there, so I opted to lift this into a new issue.
The text was updated successfully, but these errors were encountered: