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

Simplified TypeScript steps #5533

Merged
merged 1 commit into from
Oct 22, 2018
Merged

Conversation

brunolemos
Copy link
Contributor

@brunolemos brunolemos commented Oct 22, 2018

We don't need to tell users to rename multiple files at this step, only one.
And it's not needed to add {} to tsconfig anymore since #5532.

@Timer Timer added this to the 2.1 milestone Oct 22, 2018
@Timer Timer merged commit 3c11efe into facebook:master Oct 22, 2018
@bsr203
Copy link

bsr203 commented Oct 23, 2018

bit confused about step 2.

Rename src/index.js to src/index.tsx or create an empty tsconfig.json file at the root project directory.

is tsconfig.json optional (or ??)
don't we need to rename other js files (App.js etc)

also mention, an easy way to create tsconfig.json is
./node_modules/.bin/tsc --init at the root of the project

@bsr203
Copy link

bsr203 commented Oct 23, 2018

got an error trying out

$ react-scripts start
Could not find a required file.
  Name: index.js

@brunolemos
Copy link
Contributor Author

brunolemos commented Oct 23, 2018

tsconfig.json gets created automatically! :)

It was not released yet, you need to run these steps to try this now: #5541 (comment)

@bsr203
Copy link

bsr203 commented Oct 23, 2018

:-) sorry for commenting too early. It worked great. I missed yarn link react-scripts step. thanks a ton for your hard work on this and save us time setting up ts. Cheers.

@wojtekgalaj
Copy link

wojtekgalaj commented Oct 24, 2018

@brunolemos Thanks a lot for your work on TS support :)

I'm having a hard time figuring out how to make relative paths work. I'm referring to what is usually solved in CRA by using the NODE_PATH env variable. I have tried using the paths key in tsconfig but had no luck. It seems that apart from adding that key to the config I need to modify webpack config which is not available without ejecting, something I would really rather not do if at all possible.

Thanks again :)

Scratch that, paths in tsconfig work just fine. Sorry about the noise.

Buuuuut, I can't for the life of me figure out how to make those paths work with jest.

nate770 pushed a commit to ONTW/create-react-app that referenced this pull request Oct 30, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants