1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
=== tests/cases/compiler/tupleTypeInference.ts ===
declare var $q: IQService;
>$q : IQService
interface IQService {
all<T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>;
>all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>x : [IPromise<T1>, IPromise<T2>, IPromise<T3>]
all<T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>;
>all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>x : [IPromise<T1>, IPromise<T2>]
all<T1>(x: [IPromise<T1>]): IPromise<[T1]>;
>all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>x : [IPromise<T1>]
when<T>(t?: T): IPromise<T>;
>when : <T>(t?: T) => IPromise<T>
>t : T
}
interface IPromise<T> {
then<TResult>(callback: (t: T) => TResult): IPromise<TResult>;
>then : <TResult>(callback: (t: T) => TResult) => IPromise<TResult>
>callback : (t: T) => TResult
>t : T
}
// Implicit different types
var a = $q.all([$q.when<string>(), $q.when<number>()]);
>a : IPromise<[string, number]>
>$q.all([$q.when<string>(), $q.when<number>()]) : IPromise<[string, number]>
>$q.all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>$q : IQService
>all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>[$q.when<string>(), $q.when<number>()] : [IPromise<string>, IPromise<number>]
>$q.when<string>() : IPromise<string>
>$q.when : <T>(t?: T) => IPromise<T>
>$q : IQService
>when : <T>(t?: T) => IPromise<T>
>$q.when<number>() : IPromise<number>
>$q.when : <T>(t?: T) => IPromise<T>
>$q : IQService
>when : <T>(t?: T) => IPromise<T>
// Explicit different types
var b = $q.all<string, number>([$q.when<string>(), $q.when<number>()]);
>b : IPromise<[string, number]>
>$q.all<string, number>([$q.when<string>(), $q.when<number>()]) : IPromise<[string, number]>
>$q.all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>$q : IQService
>all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>[$q.when<string>(), $q.when<number>()] : [IPromise<string>, IPromise<number>]
>$q.when<string>() : IPromise<string>
>$q.when : <T>(t?: T) => IPromise<T>
>$q : IQService
>when : <T>(t?: T) => IPromise<T>
>$q.when<number>() : IPromise<number>
>$q.when : <T>(t?: T) => IPromise<T>
>$q : IQService
>when : <T>(t?: T) => IPromise<T>
// Implicit identical types
var c = $q.all([$q.when<string>(), $q.when<string>()]);
>c : IPromise<[string, string]>
>$q.all([$q.when<string>(), $q.when<string>()]) : IPromise<[string, string]>
>$q.all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>$q : IQService
>all : { <T1, T2, T3>(x: [IPromise<T1>, IPromise<T2>, IPromise<T3>]): IPromise<[T1, T2, T3]>; <T1, T2>(x: [IPromise<T1>, IPromise<T2>]): IPromise<[T1, T2]>; <T1>(x: [IPromise<T1>]): IPromise<[T1]>; }
>[$q.when<string>(), $q.when<string>()] : [IPromise<string>, IPromise<string>]
>$q.when<string>() : IPromise<string>
>$q.when : <T>(t?: T) => IPromise<T>
>$q : IQService
>when : <T>(t?: T) => IPromise<T>
>$q.when<string>() : IPromise<string>
>$q.when : <T>(t?: T) => IPromise<T>
>$q : IQService
>when : <T>(t?: T) => IPromise<T>
|