microsoft / microsoft/TypeScript
Variadic tuple constraint incoherent ?
Đang mở
@ahejlsberg đang làm issue này rồi.
Từ ngày 23/7/2020.
Awaiting More Feedback
Suggestion
- 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ả
TypeScript Version: 4.0.0-dev.20200722
Search Terms:
Variadic tuple
Variadic tuple constraint
Code
type A<GArgs extends [number, string, ...any[]]> = true;
type B<GArgs extends [string, ...any[]]> = A<[number, ...GArgs]>; // ERROR
type C = A<[number, ...[string, ...any[]]]>; // OK
Actual / Expected behavior:
On the type B we get an error:
TS2344: Type '[number, ...GArgs]' does not satisfy the constraint '[number, string, ...any[]]'. Element at index 1 is variadic in one type but not in the other
Sounds incorrect because on B, GArgs is properly shaped to be just like in C
Related Issues:
The variadic issues are a big jungle, and I was not able to find any related issue (but probably some exists?)
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.
Đánh giá
Issue này chưa được đánh giá.