microsoft / microsoft/TypeScript
TS 5.6 `files` missing from `--showConfig` (with absolute / ``${configDir}`` `include` paths)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Mô tả
🔎 Search Terms
"--showConfig", "include", "configDir", "files", "extends", "absolute"
🕗 Version & Regression Information
- Tested versions:
3.2.1(--showConfigwas introduced here)3.2.45.5.2(${configDir}was introduced here)latest=>5.6.3next=>5.7.0-dev.20241011
- This is the behaviour in every version I tried, and I reviewed the FAQ for entries about "configDir", "showConfig", "absolute".
- I was unable to test this on prior versions because
--showConfigcli flag was introduced in TS 3.2 andconfigDirtemplate variable was introduced in TS 5.5.
⏯ Playground Link
No response
💻 Code
// tsconfig-rel.json
{
//...
"include": ["src/**/*"]
}
// tsconfig-abs.json
{
//...
"include": ["/path/to/src/**/*"]
}
// tsconfig-cnf.json
{
//...
"include": ["${configDir}/src/**/*"]
}
// src/index.ts
console.log("dummy");
🙁 Actual behavior
❌ Printing config yields different results.
npx tsc --project tsconfig-rel.json --showConfig
npx tsc --project tsconfig-abs.json --showConfig
npx tsc --project tsconfig-cnf.json --showConfig
- For absolute include paths the
filesproperty is missing. ${configDir}is resolved to and behaves / fails the same as absolute paths.
{
"compilerOptions": {...},
- "files": [
- "./src/index.ts"
- ],
"include": [
- "src/**/*"
+ "/path/to/src/**/*"
],
"exclude": [...]
}
✅ Listing files yields the same output.
npx tsc --project tsconfig-rel.json --listFiles --noEmit
npx tsc --project tsconfig-abs.json --listFiles --noEmit
npx tsc --project tsconfig-cnf.json --listFiles --noEmit
List of files printed to stdout, containing
/path/to/src/index.ts/path/to/node_modules/**/*.d.tsentries from npm dependency type declarations./path/to/node_modules/typescript/lib/lib.decorators.d.ts(only in TS 5 of course)/path/to/node_modules/typescript/lib/lib.decorators.legacy.d.ts(only in TS 5 of course)
✅ Building yields the same index.js file content for all configs.
npx tsc --project tsconfig-rel.json
npx tsc --project tsconfig-abs.json
npx tsc --project tsconfig-cnf.json
🙂 Expected behavior
--showConfig should show the same files for configs that build the same files and show the same listing for --listFiles.
Additional information about the issue
includeRe in matchesSpecs seems to be calculated differently for absolute / relative paths, resulting in all files being filtered out in convertToTSConfig.
I can't tell though which behaviour is actually expected. (keep files or filter files out?)
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong src/compiler/commandLineParser.ts tại matchesSpecs và convertToTSConfig, nơi issue báo cáo cách xử lý khác nhau đối với các đường dẫn include tuyệt đối và tương đối. Tái hiện ba trường hợp tsconfig bằng tsc --showConfig, sau đó xác định đầu ra tệp dự kiến và xác minh rằng nó khớp với các tệp được --listFiles và bản build chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- cli, compilers
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100