@@ -98,7 +98,7 @@ type PolymorphicRequestHeaders =
98
98
// eslint-disable-next-line @typescript-eslint/no-explicit-any
99
99
[ key : string ] : any ;
100
100
append : ( key : string , value : string ) => void ;
101
- get : ( key : string ) => string ;
101
+ get : ( key : string ) => string | null | undefined ;
102
102
} ;
103
103
104
104
export const defaultRequestInstrumentationOptions : RequestInstrumentationOptions = {
@@ -225,15 +225,15 @@ export function fetchCallback(
225
225
* Adds sentry-trace and baggage headers to the various forms of fetch headers
226
226
*/
227
227
export function addTracingHeadersToFetchRequest (
228
- request : string | Request ,
228
+ request : string | unknown , // unknown is actually type Request but we can't export DOM types from this package ,
229
229
dynamicSamplingContext : Partial < DynamicSamplingContext > ,
230
230
span : Span ,
231
231
options : {
232
232
headers ?:
233
233
| {
234
234
[ key : string ] : string [ ] | string | undefined ;
235
235
}
236
- | Request [ 'headers' ] ;
236
+ | PolymorphicRequestHeaders ;
237
237
} ,
238
238
) : PolymorphicRequestHeaders {
239
239
const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader ( dynamicSamplingContext ) ;
@@ -265,7 +265,7 @@ export function addTracingHeadersToFetchRequest(
265
265
newHeaders . push ( [ BAGGAGE_HEADER_NAME , sentryBaggageHeader ] ) ;
266
266
}
267
267
268
- return newHeaders ;
268
+ return newHeaders as PolymorphicRequestHeaders ;
269
269
} else {
270
270
const existingBaggageHeader = 'baggage' in headers ? headers . baggage : undefined ;
271
271
const newBaggageHeaders : string [ ] = [ ] ;
0 commit comments