55 SentryEvent ,
66 SentryEventHint ,
77 SentryResponse ,
8+ SentryWrappedFunction ,
89 Severity ,
910 Status ,
1011} from '@sentry/types' ;
@@ -23,7 +24,7 @@ interface ExtensibleConsole extends Console {
2324async function beforeBreadcrumbConsoleLoopGuard (
2425 callback : ( ) => Breadcrumb | Promise < Breadcrumb | null > | null ,
2526) : Promise < Breadcrumb | null > {
26- const global = getGlobalObject ( ) ;
27+ const global = getGlobalObject ( ) as Window ;
2728 const levels = [ 'debug' , 'info' , 'warn' , 'error' , 'log' ] ;
2829
2930 if ( ! ( 'console' in global ) ) {
@@ -34,8 +35,8 @@ async function beforeBreadcrumbConsoleLoopGuard(
3435
3536 // Restore all wrapped console methods
3637 levels . forEach ( level => {
37- if ( level in global . console && originalConsole [ level ] . __sentry__ ) {
38- originalConsole [ level ] = originalConsole [ level ] . __sentry_original__ ;
38+ if ( level in global . console && ( originalConsole [ level ] as SentryWrappedFunction ) . __sentry__ ) {
39+ originalConsole [ level ] = ( originalConsole [ level ] as SentryWrappedFunction ) . __sentry_original__ ;
3940 }
4041 } ) ;
4142
@@ -44,8 +45,8 @@ async function beforeBreadcrumbConsoleLoopGuard(
4445
4546 // Revert restoration to wrapped state
4647 levels . forEach ( level => {
47- if ( level in global . console && originalConsole [ level ] . __sentry__ ) {
48- originalConsole [ level ] = originalConsole [ level ] . __sentry_wrapped__ ;
48+ if ( level in global . console && ( originalConsole [ level ] as SentryWrappedFunction ) . __sentry__ ) {
49+ originalConsole [ level ] = ( originalConsole [ level ] as SentryWrappedFunction ) . __sentry_wrapped__ ;
4950 }
5051 } ) ;
5152
0 commit comments