microsoft / microsoft/TypeScript
skipLibChecks specificity
Chưa có ai nhận issue này.
- 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
skipLibCheck specific files
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Currently skipLibCheck is an all or nothing proposition. You either suppress all errors from declaration files or you get errors from all declaration files. This is not really an accurate reflection of how declaration files are usually used. Almost all projects use declaration files from a trusted source, like npm. Errors from these files are usually not relevant and can be safely suppressed. Many projects however also have declaration files they write by hand (usually for interop with js files, or for libraries that are not typed) - these generally should be type checked since they are actively authored as part of the project.
Ideally skipLibCheck would allow us to more granularly control which declaration files are checked and which are not. This allows us to reap the performance benefits of skipLibCheck while not sacrificing type checking on authored code.
Proposal
One possible solution would be to allow skipLibCheck to be a list of glob patterns for which type checking should be skipped. This would be a simple solution allowing users to decide what declaration files they want and don't want checked.
While this solution is probably the simplest one to implement, we should consider other ones.
📃 Motivating Example
We have a custom build tool that uses the compiler API to force some declaration files to skip checking by setting their hasDefaultLib flag and using skipDefaultLibCheck instead of skipLibCheck. While this solution worked well in the past this is not really a supported solution which we expect will break (6.0 already breaks our current implementation - we have found an alternate implementation, 7.0 will make any sort of custom solution much more difficult)
💻 Use Cases
-
What do you want to use this for?
Improve build performance of TypeScript projects. -
What shortcomings exist with current approaches?
You can suppress errors from all declaration files or from none. There is no granular control over it. -
What workarounds are you using in the meantime?
Use the compiler API to control which declaration files are checked.
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 bằng việc xem xét đề xuất và hành vi hiện tại của các tùy chọn trình biên dịch skipLibCheck và skipDefaultLibCheck. Issue không nêu tên tệp hay bài kiểm thử nào, vì vậy trước khi quyết định giữa các mẫu glob hoặc những thiết kế khác, hãy xác định phần xử lý tùy chọn trình biên dịch và phạm vi kiểm thử liên quan. Hoàn thành nghĩa là việc kiểm tra tệp khai báo có thể được kiểm soát ở mức chi tiết trong khi vẫn giữ được các lợi ích về hiệu năng đã nêu.
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
- compilers
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100