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

New Typescript projects created with the CLI do not build correctly #24

Closed
bartolkaruza opened this issue Jan 9, 2019 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@bartolkaruza
Copy link

Moved here from an issue posted on React Native core: facebook/react-native#22914

The run-android part, is covered on this react-native-cli issue react-native-community/cli#65

Maybe you could have a look at point 1 of that RN issue regarding the generated project using this template?

@emin93 emin93 added the bug Something isn't working label Jan 11, 2019
@emin93
Copy link
Member

emin93 commented Jan 11, 2019

Thanks for the issue. Right now I really can't find the time to have a deeper look but I quickly read through the issues to find out what this is about.

What I can say so far:
Since RN 0.57 and Babel 7 this template doesn't do much because TypeScript is supported out of the box. The building part is being handled by Babel and the RN CLI afaik.

The only thing this template does now is adding type definitions for React & RN, replacing the App.jsx with the App.tsx, adding a .tsconfig file which is only being used to do type checking and removing obsolete files like .flowconfig. All of those things don't affect the building process, at least not in a way they would cause the error in the other issue.

Does anyone else have the same issue? Could someone have a deeper look at this?

@emin93
Copy link
Member

emin93 commented Feb 21, 2019

Hi @bartolkaruza,

So I took the time and tried to reproduce the issue but I couldn't. tsc works and also building and deploying to an Android device including live reload.

Therefore I'm going to close this issue. If you think this is wrong and I should reopen it, I'd be happy if you could create a sample repository where this issue occurs, so I can check it out and see what's going on.

@emin93 emin93 closed this as completed Feb 21, 2019
@bartolkaruza
Copy link
Author

Thank you for taking the time @emin93, I really appreciate it. The original issue was not mine, so I wouldn't be able to even tell you if this is still a problem.
OP: @Sean-Brown-Digi

@Maxwell2022
Copy link

I can reproduce it with a starter project:

$ react-native --version
react-native-cli: 2.0.1
react-native: 0.58.5
$ react-native init testApp --template typescript
$ cd testApp
$ ./node_modules/.bin/tsc
setup.js:1:1 - error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.

1 const fs = require('fs')
  ~~~~~


Found 1 error.

@emin93
Copy link
Member

emin93 commented Feb 27, 2019

Please execute the setup.js post installation script first after creating the project. This should fix the issue for you. Note that this is just a one time execution (see Readme file for detailed explanation).

With the next React Native version, the CLI will allow this to happen automatically, so you don't need to execute the setup.js manually anymore.

@Sean-Brown-Digi
Copy link

Ah ok that was my issue, I didn't know you had to run a post installation script, though that makes me wonder why the CLI doesn't just run this script automatically when it creates the project?

@emin93
Copy link
Member

emin93 commented Mar 1, 2019

@Sean-Brown-Digi In that case, please check out the README.md file. Unfortunately the React Native CLI doesn't allow automatic execution of post installation scripts but that will change in the near future. As soon as they enable that, the script will be executed automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants