Skip to content

Commit 32898c4

Browse files
committed
Handle graphql-request signal types mismatch
1 parent 3001dda commit 32898c4

File tree

1 file changed

+5
-5
lines changed
  • packages/rtk-query-graphql-request-base-query/src

1 file changed

+5
-5
lines changed

packages/rtk-query-graphql-request-base-query/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { isPlainObject } from '@reduxjs/toolkit'
22
import type { BaseQueryFn } from '@reduxjs/toolkit/query'
33
import type { DocumentNode } from 'graphql'
4-
import { GraphQLClient, ClientError } from 'graphql-request'
4+
import { GraphQLClient, ClientError, RequestOptions } from 'graphql-request'
55
import type {
66
ErrorResponse,
77
GraphqlRequestBaseQueryArgs,
@@ -43,7 +43,7 @@ export const graphqlRequestBaseQuery = <E = ErrorResponse>(
4343
data: await client.request({
4444
document,
4545
variables,
46-
signal,
46+
signal: signal as unknown as RequestOptions['signal'],
4747
requestHeaders: preparedHeaders,
4848
}),
4949
meta: {},
@@ -52,10 +52,10 @@ export const graphqlRequestBaseQuery = <E = ErrorResponse>(
5252
if (error instanceof ClientError) {
5353
const { name, message, stack, request, response } = error
5454

55-
const customErrors =
56-
options.customErrors ?? (() => ({ name, message, stack }));
55+
const customErrors =
56+
options.customErrors ?? (() => ({ name, message, stack }))
5757

58-
const customizedErrors = customErrors(error) as E;
58+
const customizedErrors = customErrors(error) as E
5959

6060
return { error: customizedErrors, meta: { request, response } }
6161
}

0 commit comments

Comments
 (0)