microsoft / microsoft/TypeScript

Module value in TSConfig does not enforce ModuleResolution value

Đang mở
#63,671 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@andrewbranch đang làm issue này rồi.

Từ ngày 27/7/2026.

Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

### 🔎 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.