Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cb: (x: T) => void not assignable to cb: (x: T) => void when it has an overload: "'any' is not assignable to 'never'" #23352

Copy link
Copy link
@ghost

Description

TypeScript Version: 2.9.0-dev.20180411

Code

declare function provide<T>(cb: (x: T) => void): void;
declare function provide<T>(cb: (x: T[keyof T]) => void): void;

declare function provider<T>(provide: (cb: (x: T) => void) => void): void;
provider(provide);

Expected behavior:

No error.

Actual behavior:

src/a.ts(4,10): error TS2345: Argument of type '{ <T>(cb: (x: T) => void): void; <T>(cb: (x: T[keyof T]) => void): void; }' is not assignable to parameter of type '(cb: (x: never) => void) => void'.
  Types of parameters 'cb' and 'cb' are incompatible.
    Types of parameters 'x' and 'x' are incompatible.
      Type 'any' is not assignable to type 'never'.

Worked in typescript@2.9.0-dev.20180327, broken in typescript@2.9.0-dev.20180328.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Won't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix itThe severity and priority of this issue do not warrant the time or complexity needed to fix it

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.