Skip to content

Commit

Permalink
graphql-request: make variables parameter optional in defaultWrapper (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlewis authored Feb 2, 2024
1 parent ad8258c commit 64c2c10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-bulldogs-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/typescript-graphql-request': patch
---

Fix unused parameter in generated code which caused TS errors for users of the package.
2 changes: 1 addition & 1 deletion packages/plugins/typescript/graphql-request/src/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class GraphQLRequestVisitor extends ClientSideBaseVisitor<

return `${additionalExportedTypes}
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();
${extraVariables.join('\n')}
export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export const Feed4Document = \`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down Expand Up @@ -527,7 +527,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down Expand Up @@ -805,7 +805,7 @@ export const Feed4Document = \`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down Expand Up @@ -1085,7 +1085,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();
const FeedDocumentString = print(FeedDocument);
const Feed2DocumentString = print(Feed2Document);
const Feed3DocumentString = print(Feed3Document);
Expand Down Expand Up @@ -1368,7 +1368,7 @@ export const Feed4Document = \`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down Expand Up @@ -1648,7 +1648,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down Expand Up @@ -1929,7 +1929,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();
const FeedDocumentString = print(FeedDocument);
const Feed2DocumentString = print(Feed2Document);
const Feed3DocumentString = print(Feed3Document);
Expand Down Expand Up @@ -2213,7 +2213,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();
const FeedDocumentString = print(FeedDocument);
const Feed2DocumentString = print(Feed2Document);
const Feed3DocumentString = print(Feed3Document);
Expand Down Expand Up @@ -2496,7 +2496,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down Expand Up @@ -2776,7 +2776,7 @@ export const Feed4Document = gql\`
export type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;


const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, variables) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand Down

0 comments on commit 64c2c10

Please sign in to comment.