c-vetter / tsconfig.js

Polyfill for tsconfig.js, because TypeScript does not natively support JS config files
https://www.npmjs.com/package/tsconfig.js
MIT License
23 stars 3 forks source link

Unexpected errors when running in a React Native project #10

Open jmarek-sky opened 3 years ago

jmarek-sky commented 3 years ago

I have a pretty standard project using React Native. It. has some cocoapods installed or the iOS version.

When I run npx tsconfig.js --once I get heaps (3829 to be exact) of errors like the one below (I included only the last one as all of them are basically the same)

error:   Invalid or unexpected token
error:   Error while processing /path/to/rn/project/ios/Pods/Analytics/Segment/Internal/UIViewController+SEGScreen.h
error:   Unexpected identifier
info:    Processing complete, with 3829 errors, see above for details
npm ERR! code 1
npm ERR! path /path/to/rn/project
npm ERR! command failed
npm ERR! command sh -c tsconfig.js "--once"

It seems that tsconfig.js tried to process all *.h files unnecessarily. When I enabled the debug logs, I saw:

debug:   Looking for files matching [
        /path/to/rn/project/**/tsconfig.js
    ]

None of the *.h files match that pattern so I guess it must be some sort of a bug.

I worked around it by ignoring the ios folder and running npx tsconfig.js --once -- ios

c-vetter commented 3 years ago

Hello @jmarek-sky Thank you for the bug report! Can you provide a simple reproduction for debugging? I'd like to add that as a test case.

A quick look at the code there's no obvious source for such an error. Except if chokidar did this wrong, but I doubt that and I found no similar issue in their repository.

Additional feedback would be appreciated, thanks 🙂

jmarek-sky commented 2 years ago

Hi @c-vetter Sorry for a very delayed response, but I missed the email notification from GitHub among heaps of other emails. I encountered the same issue in one of my pet projects which is open sourced, so I can share the steps to reproduce with you:

  1. git clone git@github.com:jar0s/reactNative-babel-wla.git
  2. cd reactNative-babel-wla
  3. yarn install
  4. cd ios_template && pod install && cd ..
  5. npx tsconfig.js --once
  6. Observe errors in the console output, last few:
error:   Error while processing /path/to/reactNative-babel-wla/ios_template/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncSocket.h
error:   Unexpected identifier
error:   Error while processing /path/to/reactNative-babel-wla/ios_template/Pods/CocoaAsyncSocket/Source/GCD/GCDAsyncUdpSocket.h
error:   Unexpected identifier
info:    Processing complete, with 3702 errors, see above for details