File tree Expand file tree Collapse file tree 5 files changed +16
-8
lines changed Expand file tree Collapse file tree 5 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ function _consoleBreadcrumb(handlerData: HandlerData & { args: unknown[]; level:
216216/**
217217 * Creates breadcrumbs from XHR API calls
218218 */
219- function _xhrBreadcrumb ( handlerData : HandlerData & { xhr : SentryWrappedXMLHttpRequest } ) : void {
219+ function _xhrBreadcrumb ( handlerData : HandlerData & { xhr : XMLHttpRequest & SentryWrappedXMLHttpRequest } ) : void {
220220 if ( handlerData . endTimestamp ) {
221221 // We only capture complete, non-sentry requests
222222 if ( handlerData . xhr . __sentry_own_request__ ) {
@@ -248,7 +248,7 @@ function _xhrBreadcrumb(handlerData: HandlerData & { xhr: SentryWrappedXMLHttpRe
248248/**
249249 * Creates breadcrumbs from fetch API calls
250250 */
251- function _fetchBreadcrumb ( handlerData : HandlerData & HandlerDataFetch ) : void {
251+ function _fetchBreadcrumb ( handlerData : HandlerData & HandlerDataFetch & { response ?: Response } ) : void {
252252 // We only capture complete fetch requests
253253 if ( ! handlerData . endTimestamp ) {
254254 return ;
Original file line number Diff line number Diff line change 11module . exports = {
22 extends : [ '../../.eslintrc.js' ] ,
3+ env : {
4+ node : true ,
5+ browser : false ,
6+ } ,
37 rules : {
48 '@typescript-eslint/no-explicit-any' : 'off' ,
59 } ,
Original file line number Diff line number Diff line change 1- type XHRSendInput = null | Blob | BufferSource | FormData | URLSearchParams | string ;
1+ // This should be: null | Blob | BufferSource | FormData | URLSearchParams | string
2+ // But since not all of those are available in node, we just export `unknown` here for now
3+ // Make sure to cast it where needed!
4+ type XHRSendInput = unknown ;
25
3- export interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
6+ export interface SentryWrappedXMLHttpRequest {
47 [ key : string ] : any ;
58 __sentry_xhr__ ?: {
69 method ?: string ;
@@ -19,5 +22,6 @@ export interface HandlerDataFetch {
1922 args : any [ ] ;
2023 fetchData : SentryFetchData ;
2124 startTimestamp : number ;
22- response ?: Response ;
25+ // This is actually `Response`, make sure to cast this where needed (not available in Node)
26+ response ?: unknown ;
2327}
Original file line number Diff line number Diff line change 44 "include" : [" src/**/*" ],
55
66 "compilerOptions" : {
7- // package-specific options
7+ "lib" : [ " ES6 " ]
88 }
99}
Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ function instrumentXHR(): void {
208208 const xhrproto = XMLHttpRequest . prototype ;
209209
210210 fill ( xhrproto , 'open' , function ( originalOpen : ( ) => void ) : ( ) => void {
211- return function ( this : SentryWrappedXMLHttpRequest , ...args : any [ ] ) : void {
211+ return function ( this : XMLHttpRequest & SentryWrappedXMLHttpRequest , ...args : any [ ] ) : void {
212212 // eslint-disable-next-line @typescript-eslint/no-this-alias
213213 const xhr = this ;
214214 const url = args [ 1 ] ;
@@ -259,7 +259,7 @@ function instrumentXHR(): void {
259259 } ) ;
260260
261261 fill ( xhrproto , 'send' , function ( originalSend : ( ) => void ) : ( ) => void {
262- return function ( this : SentryWrappedXMLHttpRequest , ...args : any [ ] ) : void {
262+ return function ( this : XMLHttpRequest & SentryWrappedXMLHttpRequest , ...args : any [ ] ) : void {
263263 if ( this . __sentry_xhr__ && args [ 0 ] !== undefined ) {
264264 this . __sentry_xhr__ . body = args [ 0 ] ;
265265 }
You can’t perform that action at this time.
0 commit comments