Missing/incomplete mutate function variables types
See original GitHub issueHi, I started using graphql-let
yesterday as a replacement for GraphQL Code Generator. Today I noticed a weird issue with types not being as strong as I’d like.
Maybe I remember wrong, but while using GraphQL Code Generator, I think I had variables of the mutate function typed and VSCode provided autocomplete when writing them. Here is an example of what I mean:
import { useChangeTickerMutation } from './tickersMutations.graphql'
const Example: FC = () => {
const [changeTicker] = useChangeTickerMutation({ variables: { } })
// ^ autocomplete/typecheck works here
const sendUpdate = () => changeTicker({ variables: { } })
// ^ autocomplete/typecheck doesn't work here (`variables` are `any`)
...
}
I tracked this to the tickersMutations.graphql.d.ts
file:
export declare function useChangeTickerMutation(baseOptions?: Apollo.MutationHookOptions<ChangeTickerMutation, ChangeTickerMutationVariables>): Apollo.MutationTuple<ChangeTickerMutation, any>;
I believe there should be Apollo.MutationTuple<ChangeTickerMutation, ChangeTickerMutationVariables>
in the end.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Data Cleaning with R and the Tidyverse: Detecting Missing ...
This is just a quick look to see the variable names and expected variable types. Looking at the dimensions of the data is...
Read more >Refetching queries in Apollo Client - Apollo GraphQL Docs
To selectively refetch queries outside of a mutation, you instead use the refetchQueries method of ApolloClient , which is documented here. client.
Read more >Complete a data frame with missing combinations of data - tidyr
To find all unique combinations of x , y and z , including those not present in the data, supply each variable as...
Read more >applying dplyr functions simultaneously across multiple columns
This shows that there are missing values in every column except for the first two ( species and island ).
Read more >35 Column-wise operations in dplyr | R for Epidemiology
For example, we passed the mean function to the .fns argument above. In the data frame above, none of the columns had any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rtrembecky Great, thanks for taking your time. I’ll publish v0.18.1 soon.
I took a bit of a dive into your codebase, it seems there are no tests/examples for mutations. Luckily, I think I found the same problems for queries. E.g. in https://github.com/piglovesyou/graphql-let/blob/main/src/__snapshots__/gen.test.ts.snap#L58-L59:
Both of these should have
ViewerQueryVariables
instead ofany
as a second generic type argument toApollo.QueryResult/QueryTuple
respectively.