segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
354 stars 181 forks source link

Problem with type export #898

Closed stereodenis closed 3 months ago

stereodenis commented 7 months ago

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch @segment/analytics-react-native@2.17.0 for the project I'm working on.

Problem with type export

Here is the diff that solved my problem:

diff --git a/node_modules/@segment/analytics-react-native/src/index.ts b/node_modules/@segment/analytics-react-native/src/index.ts
index fc29c26..79aa444 100644
--- a/node_modules/@segment/analytics-react-native/src/index.ts
+++ b/node_modules/@segment/analytics-react-native/src/index.ts
@@ -14,9 +14,7 @@ export {
 } from './util';
 export { SegmentClient } from './analytics';
 export { SegmentDestination } from './plugins/SegmentDestination';
-export {
-  CategoryConsentStatusProvider,
-  ConsentPlugin,
-} from './plugins/ConsentPlugin';
+export type { CategoryConsentStatusProvider } from './plugins/ConsentPlugin';
+export { ConsentPlugin } from './plugins/ConsentPlugin';
 export * from './flushPolicies';
 export * from './errors';

This issue body was partially generated by patch-package.

oscb commented 6 months ago

Hi @stereodenis thanks for the report and for sharing a solution for it.

I'm kinda curious about what error were you getting before this patch. Is it due to a particular typescript configuration?

oscb commented 3 months ago

Fix is already released