Skip to content

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

@bbugh

Description

@bbugh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions