Skip to content

Commit

Permalink
fix(bindings): omit variables when all keys are nullable (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Aug 19, 2022
1 parent fe2b92a commit 39bae9f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/stupid-lizards-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@urql/preact': patch
'urql': patch
'@urql/svelte': patch
'@urql/vue': patch
---

Tweak the variables type for when generics only contain nullable keys
2 changes: 2 additions & 0 deletions packages/preact-urql/src/hooks/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export type UseQueryArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/preact-urql/src/hooks/useSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export type UseSubscriptionArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/react-urql/src/hooks/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export type UseQueryArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/react-urql/src/hooks/useSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export type UseSubscriptionArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte-urql/src/mutationStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export type MutationArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte-urql/src/queryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export type QueryArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte-urql/src/subscriptionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export type SubscriptionArgs<
? {
variables?: Variables;
}
: Variables extends { [P in keyof Variables]: Variables[P] | null }
? { variables?: Variables }
: {
variables: Variables;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-urql/src/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type UseQueryArgs<T = any, V extends AnyVariables = AnyVariables> = {
? {
variables?: MaybeRef<{ [K in keyof V]: MaybeRef<V[K]> }>;
}
: V extends { [P in keyof V]: V[P] | null }
? { variables?: MaybeRef<{ [K in keyof V]: MaybeRef<V[K]> }> }
: {
variables: MaybeRef<{ [K in keyof V]: MaybeRef<V[K]> }>;
});
Expand Down
2 changes: 2 additions & 0 deletions packages/vue-urql/src/useSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type UseSubscriptionArgs<
? {
variables?: MaybeRef<{ [K in keyof V]: MaybeRef<V[K]> }>;
}
: V extends { [P in keyof V]: V[P] | null }
? { variables?: MaybeRef<{ [K in keyof V]: MaybeRef<V[K]> }> }
: {
variables: MaybeRef<{ [K in keyof V]: MaybeRef<V[K]> }>;
});
Expand Down

0 comments on commit 39bae9f

Please sign in to comment.