Skip to content

Commit ae673b2

Browse files
fix(sdk): Sentry.wrap doesn't enforce any keys on the wrapped component props (#3332)
1 parent 4576c83 commit ae673b2

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
### Fixes
5555

5656
- Change log output to show what paths are considered when collecting modules ([#3316](https://github.com/getsentry/sentry-react-native/pull/3316))
57+
- `Sentry.wrap` doesn't enforce any keys on the wrapped component props ([#3332](https://github.com/getsentry/sentry-react-native/pull/3332))
5758
- Ignore defaults when warning about duplicate definition of trace propagation targets ([#3327](https://github.com/getsentry/sentry-react-native/pull/3327))
5859
- Use deprecated `ReactNativeTracingOptions.tracingOrigins` if set in the options ([#3331](https://github.com/getsentry/sentry-react-native/pull/3331))
5960

src/js/sdk.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ export function init(passedOptions: ReactNativeOptions): void {
149149
/**
150150
* Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.
151151
*/
152-
// Deprecated in https://github.com/DefinitelyTyped/DefinitelyTyped/commit/f1b25591890978a92c610ce575ea2ba2bbde6a89
153-
// eslint-disable-next-line deprecation/deprecation
154-
export function wrap<P extends JSX.IntrinsicAttributes>(
152+
export function wrap<P extends Record<string, unknown>>(
155153
RootComponent: React.ComponentType<P>,
156154
options?: ReactNativeWrapperOptions
157155
): React.ComponentType<P> {

test/wrap.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from 'react';
2+
3+
import { wrap } from '../src/js/sdk';
4+
5+
describe('Sentry.wrap', () => {
6+
it('should not enforce any keys on the wrapped component', () => {
7+
const Mock: React.FC<{ test: 23 }> = () => <></>;
8+
const ActualWrapped = wrap(Mock);
9+
10+
expect(typeof ActualWrapped.defaultProps).toBe(typeof Mock.defaultProps);
11+
});
12+
});

0 commit comments

Comments
 (0)