alexbrazier / react-native-network-logger

An HTTP network request monitor for React Native with in-app interface for iOS and Android with no native code
MIT License
536 stars 48 forks source link

fix: Incorrect types export #99

Closed lukmccall closed 5 months ago

lukmccall commented 6 months ago

Exporting a type without annotation (not using export type) can cause some unexpected bugs. For example, when using tools like rnx-kit with tree shaking enabled, the project may fail to compile because it tries to import a non-existing type. During the tree shaking step, those types are removed, so using correct export annotations can help avoid these issues.

alexbrazier commented 5 months ago

I actually reverted this change a while ago due to it causing import errors for some people https://github.com/alexbrazier/react-native-network-logger/pull/17 https://github.com/alexbrazier/react-native-network-logger/issues/16

I'm assuming this will bring back those issues again?

lukmccall commented 5 months ago

Hello @alexbrazier, thank you for your response! AFAIK, the bundler should load the compiled JavaScript file instead of the source folder. In the linked issue, it seems like Metro is attempting to use the .ts file for some unknown reason. I'm not sure if your package was built before it was published four years ago. Still, currently, you are publishing compiled JavaScript files that shouldn't contain any information regarding exported types, at least not in .js files.