microsoft / microsoft/TypeScript
Computing constraint of conditional type by replacing contravariant infer variables with their constraints is unsound
Đang mở
@ahejlsberg đang làm issue này rồi.
Từ ngày 7/9/2018.
Bug
Domain: Conditional Types
- 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: master (8f654f0)
Search Terms:
conditional type assignability assignable constraint contravariant infer variable parameter unsound
Code
type Foo<A> = [A] extends [[infer B]] ? (arg: B) => void : never;
function fortyTwo<A>(x: Foo<A>) { x(42); }
fortyTwo<[string]>((arg: string) => console.log(arg.slice()));
Expected behavior: Compile error on x(42).
Actual behavior: Successful compilation and runtime error.
Playground Link: link
Related Issues: #26933
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á.