Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript & react-native #17858

Closed
1 of 4 tasks
AlaaInflyter opened this issue Jun 29, 2023 · 3 comments · Fixed by #18124
Closed
1 of 4 tasks

Typescript & react-native #17858

AlaaInflyter opened this issue Jun 29, 2023 · 3 comments · Fixed by #18124
Assignees
Labels
outdated scope: react-native Issues relating to React Native type: bug

Comments

@AlaaInflyter
Copy link

AlaaInflyter commented Jun 29, 2023

Current Behavior

Hi guys !
Lately, in the 0.71 Release, React Native introduced type checking with typescript.
This causes an issue with Nx because a typescript monorepo with nx is based on references.
So basically, if you run a tsc command on an app in a generated nx monorepo (following the react native tutorial), then create some lib and import it into an app, you'll get a lot of import errors.
Example:

error TS6307: File 'Path/to/some/lib/....ts' is not listed within the file list of project 'Path/to/some/app/tsconfig.app.json'. Projects must list all files or use an 'include' pattern.
  The file is in the program because:
    Imported via './lib/libName' from file 'path/to/some/lib/src/index.ts'
    Imported via './lib/libName' from file 'path/to/some/lib/src/index.ts'

Expected Behavior

A new project shouldn't produce typechecking errors.

GitHub Repo

No response

Steps to Reproduce

  1. Create a react native monorepo following a classic tutorial (eg. https://nx.dev/recipes/other/react-native)
  2. Generate a library, with a random component in it
  3. Import the library into your app
  4. run typechecking (eg. pnpm tsc -p ./path/to/app/tsconfig.app.json

Nx Report

Node   : 18.16.1
   OS     : darwin-arm64
   pnpm   : 8.6.3
   
   nx (global)        : 16.3.2
   nx                 : 16.4.0-beta.14
   @nx/js             : 16.4.0-beta.14
   @nx/jest           : 16.4.0-beta.14
   @nx/linter         : 16.4.0-beta.14
   @nx/workspace      : 16.4.0-beta.14
   @nx/detox          : 16.4.0-beta.14
   @nx/eslint-plugin  : 16.4.0-beta.14
   @nx/react          : 16.4.0
   @nx/react-native   : 16.4.0-beta.14
   @nrwl/tao          : 16.3.2
   nx-cloud           : 16.0.5
   typescript         : 5.1.3

Failure Logs

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@AgentEnder AgentEnder added the scope: react-native Issues relating to React Native label Jun 29, 2023
@Dire-State
Copy link

Same problem here, and it's the exact same problem for both expo and native projects.

Any workarounds or fixes for it?

@xiongemi
Copy link
Collaborator

i submit a pr #18124 to fix this. in tsconfig.json, to fix it locally,

  • remove composite in compilerOptions
  • change files to empty array

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react-native Issues relating to React Native type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants