Skip to content

Conversation

amehdaly
Copy link

When the user migrate the existing React JS project to support Typescript a parsing error will raise during the build when using 'as' keyword in any .tsx file, the solution is to add a missing "eslintConfig" entry configuration to 'package.json'

@facebook-github-bot
Copy link

Hi @amehdaly!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Contributor

@mrmckeb mrmckeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @amehdaly, this is done as a part of our initial set up in CRA, and isn't required.

Can you give some more context around this issue, where you hit it?

@amehdaly
Copy link
Author

Hi @amehdaly, this is done as a part of our initial set up in CRA, and isn't required.

Can you give some more context around this issue, where you hit it?

Hi @mrmckeb
Yes, in the initial CRA it's already done and added to the package.json file, but the steps to make an existing React application working using Typescript do not tell the user he/she should add the mentioned json settings manually in package.json, I had this issue when I migrated my application to support TS, here is a thread talking about it.
https://stackoverflow.com/questions/64717567/typescript-in-a-react-project-is-no-longer-recognizing-the-as-keyword

@amehdaly amehdaly requested a review from mrmckeb February 15, 2021 19:23
@mrmckeb
Copy link
Contributor

mrmckeb commented Feb 16, 2021

What version of react-scripts was the project bootstrapped with? It might be good to have a clearer migration guide overall.

Users would also hit this if they had their own ESLint config.

I assume your issue - and correct me if I'm wrong - is that your ESLint config didn't support TypeScript?

@amehdaly
Copy link
Author

amehdaly commented Feb 16, 2021

What version of react-scripts was the project bootstrapped with? It might be good to have a clearer migration guide overall.

Users would also hit this if they had their own ESLint config.

I assume your issue - and correct me if I'm wrong - is that your ESLint config didn't support TypeScript?

react-scripts version is "4.0.2", here is Gist link for the used package.json after adding the mentioned JSON entries in my PR.
https://gist.github.com/f3e60b1e98d63a7d0ac2b2df0b864448
btw, the error was thrown by the compiler during the build, not by the linter

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants