Skip to content

Overloads returning type predicate types are always incompatible with implementation #4180

@DanielRosenwasser

Description

@DanielRosenwasser

Version 1.6.0-dev.20150805

function f(x: string): x is string;
function f(x: number): x is number;
function f(x: any): boolean {
    return true;
}

Currently yields

blah.ts(1,10): error TS2394: Overload signature is not compatible with function implementa
tion.

I think this should be fixed in time for 1.6; being able to do this would enable some useful patterns.

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions