Skip to content

TS18000 circularity message prints its {0} placeholder instead of the config chain #65094

Description

🔎 Search Terms

TS18000, Circularity detected while resolving configuration, circular extends, extends, {0}, placeholder, message argument, parseConfig

🕗 Version & Regression Information

  • This changed between versions 5.9.3 and 7.0.2.
  • I tried typescript@7.0.2 and typescript@7.1.0-dev.20261101.1 (tsc -p, and the synchronous API, typescript/sync, on the nightly) and typescript@5.9.3 (tsc -p) on linux-x64.

⏯ Playground Link

The playground does not read tsconfig.json files. The reproduction is three config files and one source file in /tmp/proj.

💻 Code

tsconfig.json:

{ "extends": "./a.json" }

a.json:

{ "extends": "./b.json" }

b.json:

{ "extends": "./a.json" }

main.ts:

export const one = 1;

🙁 Actual behavior

The message keeps its {0} placeholder and names no config:

$ npx tsc -p .
error TS18000: Circularity detected while resolving configuration: {0}

The diagnostic parseConfigFile returns has the same text, Circularity detected while resolving configuration: {0}.

🙂 Expected behavior

The message names the configs in the cycle, for example /tmp/proj/a.json -> /tmp/proj/b.json -> /tmp/proj/a.json. tsc 5.9.3 names them after the whole resolution stack:

error TS18000: Circularity detected while resolving configuration: /tmp/proj/tsconfig.json -> /tmp/proj/a.json -> /tmp/proj/b.json -> /tmp/proj/a.json

Additional information about the issue

parseConfig creates the TS18000 diagnostic with no argument, where Strada's parseConfig passes the resolution stack plus the config that closes it.

#65091 fixes this. It passes only the configs of the cycle, not the whole stack, because an extended config's parse and its errors are cached by path and reused by other projects. It was noted in #64754 and #64824 as a separate cause.

I met this while building deadset-ts, the TypeScript analyzer of deadset, on the TypeScript 7 API.

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions