@@ -105,14 +105,14 @@ function stripUndefined(obj: any) {
105105 return copy
106106}
107107
108- export type FetchBaseQueryArgs = {
108+ export type FetchBaseQueryArgs < ExtraOptions = { } > = {
109109 baseUrl ?: string
110110 prepareHeaders ?: (
111111 headers : Headers ,
112112 api : Pick <
113113 BaseQueryApi ,
114114 'getState' | 'extra' | 'endpoint' | 'type' | 'forced'
115- > & { arg : string | FetchArgs } ,
115+ > & { arg : string | FetchArgs ; extraOptions : ExtraOptions } ,
116116 ) => MaybePromise < Headers | void >
117117 fetchFn ?: (
118118 input : RequestInfo ,
@@ -188,7 +188,7 @@ export type FetchBaseQueryMeta = { request: Request; response?: Response }
188188 * @param {number } timeout
189189 * A number in milliseconds that represents the maximum time a request can take before timing out.
190190 */
191- export function fetchBaseQuery ( {
191+ export function fetchBaseQuery < ExtraOptions > ( {
192192 baseUrl,
193193 prepareHeaders = ( x ) => x ,
194194 fetchFn = defaultFetchFn ,
@@ -200,19 +200,19 @@ export function fetchBaseQuery({
200200 responseHandler : globalResponseHandler ,
201201 validateStatus : globalValidateStatus ,
202202 ...baseFetchOptions
203- } : FetchBaseQueryArgs = { } ) : BaseQueryFn <
203+ } : FetchBaseQueryArgs < ExtraOptions > = { } ) : BaseQueryFn <
204204 string | FetchArgs ,
205205 unknown ,
206206 FetchBaseQueryError ,
207- { } ,
207+ ExtraOptions ,
208208 FetchBaseQueryMeta
209209> {
210210 if ( typeof fetch === 'undefined' && fetchFn === defaultFetchFn ) {
211211 console . warn (
212212 'Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments.' ,
213213 )
214214 }
215- return async ( arg , api ) => {
215+ return async ( arg , api , extraOptions ) => {
216216 const { getState, extra, endpoint, forced, type } = api
217217 let meta : FetchBaseQueryMeta | undefined
218218 let {
@@ -248,6 +248,7 @@ export function fetchBaseQuery({
248248 endpoint,
249249 forced,
250250 type,
251+ extraOptions,
251252 } ) ) || headers
252253
253254 // Only set the content-type to json if appropriate. Will not be true for FormData, ArrayBuffer, Blob, etc.
0 commit comments