Skip to content

"overload signature is not compatible" shows up more than once in the LS #49916

Closed
@jakebailey

Description

@jakebailey

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;
}

Workbench Repro

Playground Link

🙁 Actual behavior

Many, many errors, but only in the LS.

image

🙂 Expected behavior

One error about overload signatures not being correct.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-repros

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions