Skip to content

Error message on type predicates is slightly inaccurate. #16702

@DanielRosenwasser

Description

@DanielRosenwasser
declare class Container<T> {
    filter<U extends T>(predicate: (x: T) => x is U): Container<U>;
}

interface Animal {
    a
}

interface Dog extends Animal {
    d
}

declare function isDog(x: Animal): boolean;

new Container<Animal>().filter(isDog);
//                             ~~~~~

Expected: Signature '(x: Animal): boolean' must be a type predicate.
Actual: Signature '(x: Animal): boolean' must have a type predicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions