microsoft / microsoft/TypeScript
Starting overload selection in signature help doesn't account for discriminating arguments
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
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, {});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the overload example in the issue and inspect TypeScript's signature-help handling for overload selection. Verify the behavior when the discriminating first argument changes between enum values; done means signature help selects the overload matching that argument rather than retaining the previously selected overload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100