Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem
I was following this documentation which shows code like this:
When I tried that, TypeScript complained about the
variables
object. This can be also replicated by opening thecreateTestClient.test.ts
file:The fix
To fix this, I've updated the typing of the
test
function in 62bea35. With this and another fix in 4ccc129, thecreateTestClient.test.ts
file is clear of any errors.VSCode experience
The experience when typing a call site code seems to be good. Initially, it offer all three properties:
Once a query or a mutation is chosen, it narrows down suggestions to only
variables
:Providing both is an error:
Adding
variables
is valid:It is done using function overloads which I generally don't like very much but maybe here, it's a good use case for them.
Is the change from
...rest
tovariables
OK?The code now only allows (strongly-typed)
variables
while previously, it worked with...rest
. Is this change OK? I think it should be as the tests don't show any other use case but it's a change in functionality so I thought I'd rather ask.TODO
apollo-server-testing
but I've ran all tests in this package and they are green.)