@@ -98,7 +98,7 @@ type PolymorphicRequestHeaders =
9898 // eslint-disable-next-line @typescript-eslint/no-explicit-any
9999 [ key : string ] : any ;
100100 append : ( key : string , value : string ) => void ;
101- get : ( key : string ) => string ;
101+ get : ( key : string ) => string | null | undefined ;
102102 } ;
103103
104104export const defaultRequestInstrumentationOptions : RequestInstrumentationOptions = {
@@ -225,15 +225,15 @@ export function fetchCallback(
225225 * Adds sentry-trace and baggage headers to the various forms of fetch headers
226226 */
227227export 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 ,
229229 dynamicSamplingContext : Partial < DynamicSamplingContext > ,
230230 span : Span ,
231231 options : {
232232 headers ?:
233233 | {
234234 [ key : string ] : string [ ] | string | undefined ;
235235 }
236- | Request [ 'headers' ] ;
236+ | PolymorphicRequestHeaders ;
237237 } ,
238238) : PolymorphicRequestHeaders {
239239 const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader ( dynamicSamplingContext ) ;
@@ -265,7 +265,7 @@ export function addTracingHeadersToFetchRequest(
265265 newHeaders . push ( [ BAGGAGE_HEADER_NAME , sentryBaggageHeader ] ) ;
266266 }
267267
268- return newHeaders ;
268+ return newHeaders as PolymorphicRequestHeaders ;
269269 } else {
270270 const existingBaggageHeader = 'baggage' in headers ? headers . baggage : undefined ;
271271 const newBaggageHeaders : string [ ] = [ ] ;
0 commit comments