microsoft / microsoft/TypeScript
False positive error report for interface type missing index signature, thus not assignable to object type with `unknown` values.
Đang mở
@RyanCavanaugh đang làm issue này rồi.
Từ ngày 8/7/2019.
Docs
- 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: 3.6.0-dev.20190704 (3.4.3 doesn't have this bug)
Search Terms:
index signature, unknown, assignable, interface
Code
interface A {
properties?: { [Key: string]: unknown };
}
type Bar = {
key?: "value";
};
interface Baz {
key?: "value";
}
interface B extends A { // ok
properties?: Bar;
}
interface C extends A { // error: Baz is not assignable to { [Key: string]: unknown } -> Index signature is missing
properties?: Baz;
}
Expected behavior:
No error expected, interface C extends A correctly.
Actual behavior:
Error because interface C does not extend interface A
Related Issues:
#30977 (this one is specifically for enums)
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á.