Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Oct 16, 2019
1 parent 702f715 commit dea9d72
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 9 deletions.
10 changes: 9 additions & 1 deletion tests/baselines/reference/correctOrderOfPromiseMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function countEverything(): Promise<number> {
const [resultA, resultB] = await Promise.all([
providerA(),
providerB(),
] as const);
]);

const dataA: A[] = resultA;
const dataB: B[] = resultB;
Expand All @@ -24,6 +24,11 @@ async function countEverything(): Promise<number> {
}
return 0;
}

// #31179

const values = [0, 1, ''] as const;
const result: Promise<[0, 1, '']> = Promise.all(values);


//// [correctOrderOfPromiseMethod.js]
Expand Down Expand Up @@ -92,3 +97,6 @@ function countEverything() {
});
});
}
// #31179
var values = [0, 1, ''];
var result = Promise.all(values);
15 changes: 14 additions & 1 deletion tests/baselines/reference/correctOrderOfPromiseMethod.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function countEverything(): Promise<number> {
providerB(),
>providerB : Symbol(providerB, Decl(correctOrderOfPromiseMethod.ts, 11, 9))

] as const);
]);

const dataA: A[] = resultA;
>dataA : Symbol(dataA, Decl(correctOrderOfPromiseMethod.ts, 18, 9))
Expand All @@ -70,3 +70,16 @@ async function countEverything(): Promise<number> {
return 0;
}

// #31179

const values = [0, 1, ''] as const;
>values : Symbol(values, Decl(correctOrderOfPromiseMethod.ts, 28, 5))

const result: Promise<[0, 1, '']> = Promise.all(values);
>result : Symbol(result, Decl(correctOrderOfPromiseMethod.ts, 29, 5))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --) ... and 6 more)
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --) ... and 6 more)
>values : Symbol(values, Decl(correctOrderOfPromiseMethod.ts, 28, 5))

27 changes: 22 additions & 5 deletions tests/baselines/reference/correctOrderOfPromiseMethod.types
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ async function countEverything(): Promise<number> {
const [resultA, resultB] = await Promise.all([
>resultA : A[]
>resultB : B[]
>await Promise.all([ providerA(), providerB(), ] as const) : [A[], B[]]
>Promise.all([ providerA(), providerB(), ] as const) : Promise<[A[], B[]]>
>await Promise.all([ providerA(), providerB(), ]) : [A[], B[]]
>Promise.all([ providerA(), providerB(), ]) : Promise<[A[], B[]]>
>Promise.all : { <TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; <T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; <T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; <T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>; <T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>; <T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>; <T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>; <T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>; <T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>; }
>Promise : PromiseConstructor
>all : { <TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; <T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; <T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; <T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>; <T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>; <T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>; <T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>; <T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>; <T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>; }
>[ providerA(), providerB(), ] as const : readonly [Promise<A[]>, Promise<B[]>]
>[ providerA(), providerB(), ] : readonly [Promise<A[]>, Promise<B[]>]
>[ providerA(), providerB(), ] : [Promise<A[]>, Promise<B[]>]

providerA(),
>providerA() : Promise<A[]>
Expand All @@ -44,7 +43,7 @@ async function countEverything(): Promise<number> {
>providerB() : Promise<B[]>
>providerB : () => Promise<B[]>

] as const);
]);

const dataA: A[] = resultA;
>dataA : A[]
Expand Down Expand Up @@ -72,3 +71,21 @@ async function countEverything(): Promise<number> {
>0 : 0
}

// #31179

const values = [0, 1, ''] as const;
>values : readonly [0, 1, ""]
>[0, 1, ''] as const : readonly [0, 1, ""]
>[0, 1, ''] : readonly [0, 1, ""]
>0 : 0
>1 : 1
>'' : ""

const result: Promise<[0, 1, '']> = Promise.all(values);
>result : Promise<[0, 1, ""]>
>Promise.all(values) : Promise<[0, 1, ""]>
>Promise.all : { <TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; <T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; <T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; <T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>; <T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>; <T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>; <T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>; <T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>; <T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>; }
>Promise : PromiseConstructor
>all : { <TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; <T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; <T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; <T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>; <T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>; <T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>; <T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>; <T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>; <T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>; }
>values : readonly [0, 1, ""]

13 changes: 13 additions & 0 deletions tests/baselines/reference/typeInferenceWithTupleType.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ var zipResult = zip(["foo", "bar"], [5, 6]);
var zipResultEle = zipResult[0]; // [string, number]
var zipResultEleEle = zipResult[0][0]; // string

// #33559 and #33752

interface I<T> {}
declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1;
declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1;

declare const values: [I<1>, I<number>];
let one: 1;
one = f1(values);
one = f2(values);


//// [typeInferenceWithTupleType.js]
Expand All @@ -46,3 +56,6 @@ function zip(array1, array2) {
var zipResult = zip(["foo", "bar"], [5, 6]);
var zipResultEle = zipResult[0]; // [string, number]
var zipResultEleEle = zipResult[0][0]; // string
var one;
one = f1(values);
one = f2(values);
45 changes: 45 additions & 0 deletions tests/baselines/reference/typeInferenceWithTupleType.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,49 @@ var zipResultEleEle = zipResult[0][0]; // string
>0 : Symbol(0)
>0 : Symbol(0)

// #33559 and #33752

interface I<T> {}
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 26, 12))

declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1;
>f1 : Symbol(f1, Decl(typeInferenceWithTupleType.ts, 26, 17))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 27, 23))
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 27, 28))
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20))
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 27, 23))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20))

declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1;
>f2 : Symbol(f2, Decl(typeInferenceWithTupleType.ts, 27, 56))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 28, 20))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 28, 23))
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 28, 28))
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 28, 20))
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 28, 23))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 28, 20))

declare const values: [I<1>, I<number>];
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 30, 13))
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))
>I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38))

let one: 1;
>one : Symbol(one, Decl(typeInferenceWithTupleType.ts, 31, 3))

one = f1(values);
>one : Symbol(one, Decl(typeInferenceWithTupleType.ts, 31, 3))
>f1 : Symbol(f1, Decl(typeInferenceWithTupleType.ts, 26, 17))
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 30, 13))

one = f2(values);
>one : Symbol(one, Decl(typeInferenceWithTupleType.ts, 31, 3))
>f2 : Symbol(f2, Decl(typeInferenceWithTupleType.ts, 27, 56))
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 30, 13))

30 changes: 30 additions & 0 deletions tests/baselines/reference/typeInferenceWithTupleType.types
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,34 @@ var zipResultEleEle = zipResult[0][0]; // string
>0 : 0
>0 : 0

// #33559 and #33752

interface I<T> {}
declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1;
>f1 : <T1, T2>(values: [I<T1>, I<T2>]) => T1
>values : [I<T1>, I<T2>]

declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1;
>f2 : <T1, T2>(values: readonly [I<T1>, I<T2>]) => T1
>values : readonly [I<T1>, I<T2>]

declare const values: [I<1>, I<number>];
>values : [I<1>, I<number>]

let one: 1;
>one : 1

one = f1(values);
>one = f1(values) : 1
>one : 1
>f1(values) : 1
>f1 : <T1, T2>(values: [I<T1>, I<T2>]) => T1
>values : [I<1>, I<number>]

one = f2(values);
>one = f2(values) : 1
>one : 1
>f2(values) : 1
>f2 : <T1, T2>(values: readonly [I<T1>, I<T2>]) => T1
>values : [I<1>, I<number>]

7 changes: 6 additions & 1 deletion tests/cases/compiler/correctOrderOfPromiseMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function countEverything(): Promise<number> {
const [resultA, resultB] = await Promise.all([
providerA(),
providerB(),
] as const);
]);

const dataA: A[] = resultA;
const dataB: B[] = resultB;
Expand All @@ -26,3 +26,8 @@ async function countEverything(): Promise<number> {
}
return 0;
}

// #31179

const values = [0, 1, ''] as const;
const result: Promise<[0, 1, '']> = Promise.all(values);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function combine<T, U>(x: T, y: U): [T, U] {
function combine<T, U>(x: T, y: U): [T, U] {
return [x, y];
}

Expand All @@ -22,3 +22,13 @@ var zipResult = zip(["foo", "bar"], [5, 6]);
var zipResultEle = zipResult[0]; // [string, number]
var zipResultEleEle = zipResult[0][0]; // string

// #33559 and #33752

interface I<T> {}
declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1;
declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1;

declare const values: [I<1>, I<number>];
let one: 1;
one = f1(values);
one = f2(values);

0 comments on commit dea9d72

Please sign in to comment.