Closed
Description
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.