-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
CRA 3 fails to handle a trailing comma in tsconfig.json - TSC has no problem #6865
Comments
Yeah you're definitely right that tsconfig.json supports it. We'll have to investigate this. Likely a JSON.parse() somewhere. |
TypeScript also allows you to put comments in |
I think as long as a JSONC parser is used it should all go through because that's what TS is using I'd assume. |
Unfortunately it looks like typescript uses a hand-written parser. I traced it down to If we're allowed to hook into the typescript package, it looks like they provide public access to their parse function. |
For whomever investigates this, I recommend taking a look at https://github.com/Realytics/fork-ts-checker-webpack-plugin for similar logic. I did a few PRs there related to parsing tsconfig using the TypeScript API that may be helpful. However be careful as some of their functions will actually mutate the config. May not be worth using TS API potentially. |
This might have been fixed by #7248? In which case can be closed. I see it deals with comments, not sure if it fixed the commas as well? |
@TomasHubelbauer You're absolutely right! |
This is a bug report. To reproduce it, run
npx create-react-app . --typescript
and change the"jsx": "preserve"
line to"jsx": "preserve",
. This is with CRA3 and I don't think this happened in CRA2 because I kept mytsconfig.json
the same while upgrading CRA from 2 to 3 and only now got the error. I think this is a CRA issue because runningtsc -p .
in the directory goes through with no problem.The text was updated successfully, but these errors were encountered: