dotansimha / dotansimha/graphql-code-generator-community
[typescript-urql] Hook option variables are always optional
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
**Describe the bug**
This is a follow up to https://github.com/dotansimha/graphql-code-generator/issues/7163
The resolution of issue 7163 (release 3.5.0) made the options parameter required when variables are required, but the variables field of that object is still optional, even when the query has required variables.
**To Reproduce**
Write any query with a required variable. When using the hook for that query, you are able to omit the variables field.
```graphql
query MySubscription($userId: String!) {
...
}
```
```
useMySubscriptionQuery() // Now fails in 3.5.0
useMySubscriptionQuery({}) // Compiles, but is still incorrect
useMySubscriptionQuery({variables: {userId: "123"}}) // The correct requirement
```
**Expected behavior**
For queries with required variables, I would expect `useMySubscriptionQuery({}) ` to fail to compile, as variables have not been provided.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.