Open EdwardDrapkin opened 8 months ago
The reason is that react-native is using the untranspiled typescript files from node_modules/reactotron-core-client/src/
.
That way you get every ts error from that code.
A workaround from user side is to use the transpiled js & .d.ts files, that way ts can ignore those error:
diff --git a/node_modules/reactotron-core-client/package.json b/node_modules/reactotron-core-client/package.json
index 92c5d75..a19bd44 100644
--- a/node_modules/reactotron-core-client/package.json
+++ b/node_modules/reactotron-core-client/package.json
@@ -19,7 +19,7 @@
"react-native": "src/index.ts",
"exports": {
"import": "./dist/index.esm.js",
- "react-native": "./src/index.ts",
+ "react-native": "./dist/index.js",
"types": "./dist/types/src/index.d.ts",
"default": "./dist/index.js"
},
(this is for RN73, if you are on older version you have to change the other "react-native" entry)
Jest is failing with the tests and i believe its due to the same issue. The suggestion of @WookieFPV haven't solved it for me:
I have the same problem and the solutions above is not working... Any update?
This PR should solve these problems:
Well, once you merge it, i will let you know :)
Any updates?
are there any updates on this one?
just had this problem happen today as I tried reactotron for the forst time, uninstalling for now.
any updates?
As a temp solution I changed from import to require and TS stops checking the package:
before
import Reactotron, { networking } from 'reactotron-react-native'
import { reactotronRedux } from 'reactotron-redux'
after
const { reactotronRedux } = require('reactotron-redux')
const Reactotron = require('reactotron-react-native').default
const { networking } = require('reactotron-react-native')
As a temp solution I changed from import to require and TS stops checking the package:
before
import Reactotron, { networking } from 'reactotron-react-native' import { reactotronRedux } from 'reactotron-redux'
after
const { reactotronRedux } = require('reactotron-redux') const Reactotron = require('reactotron-react-native').default const { networking } = require('reactotron-react-native')
it helped, thanks!
As a temp solution I changed from import to require and TS stops checking the package:
before
import Reactotron, { networking } from 'reactotron-react-native' import { reactotronRedux } from 'reactotron-redux'
after
const { reactotronRedux } = require('reactotron-redux') const Reactotron = require('reactotron-react-native').default const { networking } = require('reactotron-react-native')
In my case this unfortunately doesn't work (at least in a Jest test):
import reactotron from "./reactotron-react-native"
^^^^^^
SyntaxError: Cannot use import statement outside a module
2 | // https://github.com/infinitered/reactotron/issues/1483
3 | // https://github.com/infinitered/reactotron/issues/1430#issuecomment-2180872830
> 4 | const Reactotron = require('reactotron-react-native').default;
| ^
5 | const {networking} = require('reactotron-react-native');
6 |
7 | Reactotron.configure({}).use(networking()).useReactNative().connect();
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
at Object.<anonymous> (ReactotronConfig.js:4:62)
at Object.require (App.tsx:6:3)
at Object.require (App.test.tsx:14:1)
tsconfig:
Include location:
tsc output: