microsoft / microsoft/TypeScript

Module value in TSConfig does not enforce ModuleResolution value

Aperta
#63,671 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@andrewbranch ci sta già lavorando.

Dal 27/7/2026.

Needs Investigation
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

### 🔎 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:
```json
{
"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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.