Skip to content

Error inferring tuple type arguments #16360

Description

TypeScript Version: nightly (2.4.0-dev.20170608)

Code

interfaceIPromise<T>{then<U>(onFulfill: (value: T)=>IWhenable<U>): IPromise<U>;}interfaceQPromise<T>{then<U>(onFulfill: (value: T)=>IWhenable<U>): IPromise<U>;}typeIWhenable<T>=IPromise<T>|T;declarefunctionall<A,B>(promises: IWhenable<[IWhenable<A>,IWhenable<B>]>): IPromise<[A,B]>;declareconstprom1: QPromise<[QPromise<string>,QPromise<number>]>;constx1: IPromise<[string,number]>=all(prom1);constprom2: IPromise<[IPromise<string>,IPromise<number>]>=prom1;constx2: IPromise<[string,number]>=all(prom2);

Expected behavior:

Since IPromise and QPromise have identical bodies, I would expect these to both work.

Actual behavior:

x1 fails, x2 succeeds.

src/a.ts(14,7): error TS2322: Type 'IPromise<[QPromise<string>, QPromise<number>]>' is not assignable to type 'IPromise<[string, number]>'.
Type '[QPromise<string>, QPromise<number>]' is not assignable to type '[string, number]'.
Type 'QPromise<string>' is not assignable to type 'string'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolution

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions