microsoft / microsoft/TypeScript
Creating too many types for DOM & D3
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ả
Commit 06fe1ed53721862b56c61ebb89b1daee2bc10710 introduced a regression in the number of types created when compiling a snippet of @types\d3. Specifically, it appears to be elaborating types for an error message that ends up getting dropped.
Repro:
{
"compileOnSave": false,
"compilerOptions": {
"alwaysStrict": true,
"noImplicitAny": true,
"noEmit": true,
"lib": [ "es5", "dom" ],
"noResolve": true,
"types": [],
"skipLibCheck": true
},
"files": [
"test.ts",
}
test.ts
declare function select<GElement extends BaseType, OldDatum>(selector: string): Selection2<GElement, OldDatum, HTMLElement, any>;
type BaseType = Element | Document | Window | null | number;
type ValueFn<T extends BaseType, Datum, Result> = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike<T>) => Result;
interface Selection2<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
select<DescElement extends BaseType>(selector: ValueFn<GElement, Datum, DescElement>): Selection2<DescElement, Datum, PElement, PDatum>;
}
For an apples-to-apples comparison, use nolib and specify the 3.1 lib.es5.d.ts and lib.dom.d.ts for both compilations.
In round numbers, there are ~150 types without the change and ~2500 types with the change.
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
Tái hiện vấn đề với compilerOptions được cung cấp và đoạn mã test.ts, so sánh số lượng kiểu khoảng 150 với 2500 bằng các tệp lib.es5.d.ts và lib.dom.d.ts của 3.1. Kiểm tra commit 06fe1ed53721862b56c61ebb89b1daee2bc10710 và đường đi xử lý diễn giải thông báo lỗi của compiler. Được xem là hoàn tất khi việc biên dịch bản tái hiện không còn diễn giải các kiểu thông báo lỗi bị loại bỏ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- d3, typescript
- Lĩnh vực
- compilers, performance
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 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
- 32/100