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

Constraints cannot be proven in mapped types combination #13039

Copy link
Copy link
@Igorbek

Description

@Igorbek
Issue body actions

TypeScript Version: 2.1.4 / nightly (2.2.0-dev.20161219)

Code

type A<T> = () => T;
type B<T, C extends A<T>> = C;
type As<Ts> = {
    [P in keyof Ts]: A<Ts[P]>;
};

type Failing<Ts, Cs extends As<Ts>> = {
    [P in keyof Ts]: B<Ts[P], Cs[P]>;
//                            ~~~~~ Type 'Cs[P]' does not satisfy the constraint 'A<Ts[P]>'.
};

Expected behavior:

No errors, the constraint has been proven

Actual behavior:

Error in Failing type at B<Ts[P], Cs[P]>: Type 'Cs[P]' does not satisfy the constraint 'A<Ts[P]>'.

Note

If I change A<T> to be just T (type A<T> = T;), all compiles just fine.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    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.