Skip to content

Allow comments in tsconfig.json #13

@js3692

Description

@js3692

It seems like comments cannot be used currently (i.e. input is expected to be a "valid" JSON), looking at (in this file):

function convertCompilerOptionsOrThrow(options) {
  if (!options) return null;

  var result = ts.convertCompilerOptionsFromJson(options, '');

  if (result.errors && result.errors.length) {
    throw new Error(result.errors[0].messageText);
  }

  return result.options;
}

Looking at this example, I think the parseConfigFileTextToJson function might be useful here to allow comments inside tsconfig.json.

Do you have any advice on how to enable comments in the config file? Happy to open a PR in the compiler repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions