"overload signature is not compatible" shows up more than once in the LS
Bug Report
🔎 Search Terms
overload signature is not compatible language server vs code vscode diagnostic problem error
🕗 Version & Regression Information
Probably #40094. But, old TS had one error in 3.3, then 2 in 3.5, then 7 in 4.1+, so this isn't just one PR.
⏯ Playground Link
// @strict: true
// @errors: 2394
export interface Push<T> {
push(...values: T[]): void;
/* @internal*/ readonly length: number;
}
export function append<TArray extends any[] | undefined, TValue extends NonNullable<TArray>[number] | undefined>(to: TArray, value: TValue): [undefined, undefined] extends [TArray, TValue] ? TArray : NonNullable<TArray>[number][];
export function append<T>(to: T[], value: T | undefined): T[];
export function append<T>(to: T[] | undefined, value: T): T[];
export function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined;
export function append<T>(to: Push<T>, value: T | undefined): void;
export function append<T>(to: T[], value: T | undefined): T[] | undefined {
if (value === undefined) return to;
if (to === undefined) return [value];
to.push(value);
return to;
}
🙁 Actual behavior
Many, many errors, but only in the LS.

🙂 Expected behavior
One error about overload signatures not being correct.
The errors go away if you get rid of export on everything, and #40094 made the check always occur: https://github.com/microsoft/TypeScript/pull/40094/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8R32219
Which is probably the problem, though I am confused as to how this error is not suppressed for being duplicated. Or why all positions are the same when it's each individual overload that should be checked.
Thankfully testable using fourslash (but not a compiler test):
Semantic Diagnostics for file '/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts':
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
/tests/cases/fourslash/overloadNotCompatibleErrorDuplication.ts(8,17): error TS2394: This overload signature is not compatible with its implementation signature.
:wave: Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in the issue body running against the nightly TypeScript.
Issue body code block by @jakebailey
:x: Failed: -
This overload signature is not compatible with its implementation signature.
Historical Information
| Version | Reproduction Outputs |
|---|---|
| 4.3.2, 4.4.2, 4.5.2, 4.6.2, 4.7.2 |
:x: Failed: -
|
@typescript-bot bisect good v3.3.3 bad v3.5.1
Turns out this was fixed by #50309 (which I think has enough test coverage).