Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

`Cannot use import statement outside a module` when combining RN and ts-node

$
0
0

I created a small CLI tool to automate some process on my React Native project.Recently I had to update the RN from 0.61.4 to 0.63.2 to address some iOS issues.Since this update, the CLI is not working anymore.

The errors are:

yarn ts-node -r tsconfig-paths/register ./scripts/checkimport typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';^^^^^^SyntaxError: Cannot use import statement outside a module

and

yarn ts-node -r esm -r tsconfig-paths/register ./scripts/checkimport typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';       ^SyntaxError: Invalid or unexpected token

I've tried a bunch of solutions but feels that I fix A and break B, and vice-versa.Important to mention that some files from this CLI are shared with the RN app, and the RN app is working fine.

I believe I need to clear the flow typings from RN, but @babel/plugin-transform-flow-strip-types did not help


Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>