Skip to content

Commit 209f66f

Browse files
feat(sdk): re-export ErrorEvent and TransactionEvent types (#4859)
Co-authored-by: LucasZF <[email protected]>
1 parent c4b4e7a commit 209f66f

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Adds the `FeedbackButton` component that shows the Feedback Widget ([#4378](https://github.com/getsentry/sentry-react-native/pull/4378))
1414
- Adds the `ScreenshotButton` component that takes a screenshot ([#4714](https://github.com/getsentry/sentry-react-native/issues/4714))
1515
- Add Feedback Widget theming ([#4677](https://github.com/getsentry/sentry-react-native/pull/4677))
16+
- Re-export `ErrorEvent` and `TransactionEvent` types ([#4859](https://github.com/getsentry/sentry-react-native/pull/4859))
1617

1718
### Fixes
1819

packages/core/src/js/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export type {
1212
Thread,
1313
User,
1414
UserFeedback,
15+
ErrorEvent,
16+
TransactionEvent,
1517
} from '@sentry/core';
1618

1719
export {

samples/expo/app/_layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useEffect } from 'react';
77
import { useColorScheme } from '@/components/useColorScheme';
88
import { SENTRY_INTERNAL_DSN } from '../utils/dsn';
99
import * as Sentry from '@sentry/react-native';
10-
import { ErrorEvent } from '@sentry/core';
1110
import { isExpoGo } from '../utils/isExpoGo';
1211
import { LogBox } from 'react-native';
1312
import { isWeb } from '../utils/isWeb';
@@ -32,11 +31,11 @@ Sentry.init({
3231
dsn: SENTRY_INTERNAL_DSN,
3332
debug: true,
3433
environment: 'dev',
35-
beforeSend: (event: ErrorEvent) => {
34+
beforeSend: (event: Sentry.ErrorEvent) => {
3635
console.log('Event beforeSend:', event.event_id);
3736
return event;
3837
},
39-
beforeSendTransaction(event) {
38+
beforeSendTransaction(event: Sentry.TransactionEvent) {
4039
console.log('Transaction beforeSend:', event.event_id);
4140
return event;
4241
},

samples/react-native-macos/src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { LogBox, Platform, StyleSheet, View } from 'react-native';
3131
import Ionicons from 'react-native-vector-icons/Ionicons';
3232
import PlaygroundScreen from './Screens/PlaygroundScreen';
3333
import { logWithoutTracing } from './utils';
34-
import { ErrorEvent } from '@sentry/core';
3534

3635
LogBox.ignoreAllLogs();
3736
const isMobileOs = Platform.OS === 'android' || Platform.OS === 'ios';
@@ -47,11 +46,11 @@ Sentry.init({
4746
dsn: SENTRY_INTERNAL_DSN,
4847
debug: true,
4948
environment: 'dev',
50-
beforeSend: (event: ErrorEvent) => {
49+
beforeSend: (event: Sentry.ErrorEvent) => {
5150
logWithoutTracing('Event beforeSend:', event.event_id);
5251
return event;
5352
},
54-
beforeSendTransaction(event) {
53+
beforeSendTransaction(event: Sentry.TransactionEvent) {
5554
logWithoutTracing('Transaction beforeSend:', event.event_id);
5655
return event;
5756
},

samples/react-native/src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { LogBox, Platform, StyleSheet, View } from 'react-native';
3232
import Ionicons from 'react-native-vector-icons/Ionicons';
3333
import PlaygroundScreen from './Screens/PlaygroundScreen';
3434
import { getDsn, logWithoutTracing } from './utils';
35-
import { ErrorEvent } from '@sentry/core';
3635
import HeavyNavigationScreen from './Screens/HeavyNavigationScreen';
3736
import WebviewScreen from './Screens/WebviewScreen';
3837
import { isTurboModuleEnabled } from '@sentry/react-native/dist/js/utils/environment';
@@ -62,11 +61,11 @@ Sentry.init({
6261
dsn: getDsn(),
6362
debug: true,
6463
environment: 'dev',
65-
beforeSend: (event: ErrorEvent) => {
64+
beforeSend: (event: Sentry.ErrorEvent) => {
6665
logWithoutTracing('Event beforeSend:', event.event_id);
6766
return event;
6867
},
69-
beforeSendTransaction(event) {
68+
beforeSendTransaction(event: Sentry.TransactionEvent) {
7069
logWithoutTracing('Transaction beforeSend:', event.event_id);
7170
return event;
7271
},

0 commit comments

Comments
 (0)