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

tsconfig.json parsing using JSON.parse which does not support all features that tsc does #840

Open
bbugh opened this issue Jul 24, 2024 · 0 comments

Comments

@bbugh
Copy link

bbugh commented Jul 24, 2024

The TypeScript tsc compiler (and other tools) use jsonc format, that includes comments, but Sucrase uses the built in JSON parser, which has problems:

  • JSON.parse does not support comments.
  • JSON.parse will fail on trailing commas

This means that the default output of tsc --init immediately breaks this tool.

I recommend using jsonc-parser which is the same package that VSCode uses for reading its json configuration files. This would ensure sucrase supports the same features as TypeScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant