Skip to content

Investigate the use of readConfigFile() and friends #44516

Closed as not planned
Closed as not planned

Description

@RA80533
  • Its documentation states that it reads tsconfig.json files
  • It appears to have the same functionality and level of abstraction as readJsonConfigFile()
  • The function is not marked with /* internal */ despite it lacking consumer-level documentation

/**
* Read tsconfig.json file
* @param fileName The path to the config file
*/
export function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): { config?: any; error?: Diagnostic } {
const textOrDiagnostic = tryReadFile(fileName, readFile);
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
}

  • In at least one area, it's used in a manner contradictory of its own documentation (see PackageJson)

const jsonConfig: PackageJson = readConfigFile(jsonPath, path => host.readFile(path)).config;

Activity

  1. changed the title [-]Investigate the use of `readConfigFile`[/-] [+]Investigate the use of `readConfigFile()`[/+] on Jun 9, 2021
  2. changed the title [-]Investigate the use of `readConfigFile()`[/-] [+]Investigate the use of `readConfigFile()` and friends[/+] on Jun 9, 2021
  3. RyanCavanaugh commented on Jun 9, 2021

    @RyanCavanaugh
    Member

    This is more of a set of observations than a bug report. Since these are now public APIs, I'm not sure what you'd like to see happen here -- at best, we could break some consumers. The documentation comments could be a bit better but the same is true of every comment 😉

  4. RA80533 commented on Jun 9, 2021

    @RA80533
    Author

    This is certainly more of an observation than anything. I suppose the goal of this was to have a clear understanding of that area in order to update the documentation accordingly.

  5. github-actions commented on Jun 8, 2023

    @github-actions

    This issue has been marked as 'Not a Defect' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions