Skip to content

Constraints of functions passed as argument are not checked #14766

Closed
@gcnew

Description

@gcnew

TypeScript Version: nightly

Code

declare function p(x: 'hello'): 'hello';
declare function g<T extends string>(x: T): T;

declare function h(f: (x: number) => number): number;
declare function f<T extends number>(f: (x: T) => T): T;

h(p); // Error as expected
h(g); // Uncaught error
f(g); // Uncaught error

Expected behavior:
All of the above invokations should be errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions