angular/components · error · TsconfigParseError

formatDiagnostics(errors, fileSystem)

Error message

formatDiagnostics(errors, fileSystem)

What it means

After ts.parseJsonConfigFileContent succeeds structurally, any semantic configuration errors remain in parsed.errors. The tool filters out the benign 'No inputs found' (code 18003) and throws TsconfigParseError with formatted diagnostics for anything else — meaning the tsconfig content itself is invalid (bad compiler options, invalid extends, wrong target, etc.).

Source

Thrown at src/cdk/schematics/update-tool/utils/parse-tsconfig.ts:56

  // If there is a config reading error, we never attempt to parse the config.
  if (error) {
    throw new TsconfigParseError(formatDiagnostics([error], fileSystem));
  }

  const parsed = ts.parseJsonConfigFileContent(
    config,
    new FileSystemHost(fileSystem),
    dirname(tsconfigPath),
    {},
  );

  // Skip the "No inputs found..." error since we don't want to interrupt the migration if a
  // tsconfig doesn't match a file. This will result in an empty `Program` which is still valid.
  const errors = parsed.errors.filter(diag => diag.code !== NO_INPUTS_ERROR_CODE);

  if (errors.length) {
    throw new TsconfigParseError(formatDiagnostics(errors, fileSystem));
  }

  return parsed;
}

View on GitHub (pinned to 0411926e7d)

Solutions

  1. Read the diagnostic in the error message and fix the offending tsconfig option or value it names.
  2. Remove or correct unknown/renamed compilerOptions (check the TypeScript version's valid options).
  3. Fix the 'extends' path so it resolves to an existing tsconfig file.
  4. Validate the file with `tsc --showConfig` (or `tsc -p <file> --noEmit`) to see the same errors outside the migration.

Example fix

// before
{
  "compilerOptions": {
    "strictTyps": true
  }
}
// after
{
  "compilerOptions": {
    "strict": true
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

import {execSync} from 'child_process';
try {
  execSync(`tsc -p ${tsconfigPath} --noEmit --skipLibCheck`, {stdio: 'ignore'});
} catch {
  console.error(`tsconfig at ${tsconfigPath} has invalid options; run tsc -p ${tsconfigPath} --noEmit to see them`);
}

Try / catch

try {
  const parsed = parseTsconfigFile(path, fileSystem);
} catch (e) {
  if (e instanceof TsconfigParseError) {
    // message contains formatted TS diagnostics naming the bad options
    console.error('Fix tsconfig errors reported below:\n' + e.message);
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: parseTsconfigFile's parsed.errors array (excluding code 18003) is non-empty — e.g. unknown compilerOptions keys, invalid option values, unresolvable 'extends' targets, or malformed files/include patterns other than the no-inputs case.

Common situations: Upgrading TypeScript/angular versions makes an old option invalid, a typo like 'compilerOption', an extends path pointing to a deleted file, or an include/exclude glob referencing an invalid location.

Related errors


AI-assisted analysis of angular/components@0411926e7d (2026-08-31). Data as JSON: /api/errors/9cce82bb6691513c. Report an issue: GitHub.