microsoft / microsoft/TypeScript

Module value in TSConfig does not enforce ModuleResolution value

Offen
#63,671 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@andrewbranch arbeitet bereits daran.

Seit 27.7.2026.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔎 Search Terms

moduleresolution enforce

🕗 Version & Regression Information

I tested also on typescript 5 and the behavior was the same

⏯ Playground Link

No response

💻 Code

According to docs certain module values imply and enforce certain moduleResolution values as decribed at https://www.typescriptlang.org/docs/handbook/modules/reference.html#implied-and-enforced-options

However the following tsconfig works without any issue:

{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "node16", // this should not be allowed
    "outDir": "dist",
    "rootDir": ".",
    "sourceMap": true,
    "strict": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "types": ["*"]
  }
}

even when according to docs --module nodenext should enforce --moduleResolution nodenext

🙁 Actual behavior

the tsc compilation works with option that should fail according to docs

🙂 Expected behavior

fix the behavior or the docs

Additional information about the issue

typescript version: 6.0.3

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.