microsoft / microsoft/TypeScript
Starting overload selection in signature help doesn't account for discriminating arguments
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ả
TS Template added by @mjbvz
TypeScript Version: 3.8.0-dev.20200201
Search Terms
- overload
Incorrect types sugestion with overload
https://gitlab.com/kamidere-laboratory/duat/tree/testy
overload is declarated in src/database/Controller.ts method create
- VSCode Version: 1.41.1
- OS Version: Windows_NT x64 10.0.18362
Steps to Reproduce:
- Write Database.create(DatabaseType.Graphite, {}) // now we get Influx overload xD
- Change DatabaseType.Graphite to DatabaseType.Sqlite // now we get Sqlite overload :D
- Change back to DatabaseType.Graphite // now we still get Sqlite overload :(
https://youtu.be/a7FHxIItceA
Does this issue occur when all extensions are disabled?: Yes



interface a {
a: string;
b: string;
c: {
a:number;
b:string;
}
}
interface b {
a: string;
b: string;
c: {
a: number;
b: string;
c: string[];
}
}
interface c {
a: string;
b: string;
}
enum d {
"A" = 'a',
"B" = 'b',
"C" = 'c',
}
class testClass {
constructor(arg1: d, arg2: a | b | c) {
console.log(arg1, arg2)
}
static doSomething(arg1: d.A, arg2: a): testClass;
static doSomething(arg1: d.B, arg2: b): testClass;
static doSomething(arg1: d.C, arg2: c): testClass;
static doSomething(arg1: d, arg2: a | b | c): testClass {
return new this(arg1, arg2);
}
}
testClass.doSomething(d.C, {});
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 cách tái hiện ví dụ về overload trong issue và kiểm tra cách TypeScript xử lý signature help để chọn overload. Xác minh hành vi khi đối số đầu tiên dùng để phân biệt thay đổi giữa các giá trị enum; hoàn thành khi signature help chọn overload khớp với đối số đó thay vì giữ lại overload đã được chọn trước đó.
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
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 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
- 35/100