| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ async function countEverything(): Promise<number> { | |||
| 15 | 15 | const [resultA, resultB] = await Promise.all([ | |
| 16 | 16 | providerA(), | |
| 17 | 17 | providerB(), | |
| 18 | - ] as const); | ||
| 18 | + ]); | ||
| 19 | 19 | ||
| 20 | 20 | const dataA: A[] = resultA; | |
| 21 | 21 | const dataB: B[] = resultB; | |
@@ -24,6 +24,10 @@ async function countEverything(): Promise<number> { | |||
| 24 | 24 | } | |
| 25 | 25 | return 0; | |
| 26 | 26 | } | |
| 27 | + | ||
| 28 | + // #31179 | ||
| 29 | + | ||
| 30 | + const expected: Promise<['a', 'b', 'c']> = Promise.all(undefined as readonly ['a', 'b', 'c']); | ||
| 27 | 31 | ||
| 28 | 32 | ||
| 29 | 33 | //// [correctOrderOfPromiseMethod.js] | |
@@ -92,3 +96,5 @@ function countEverything() { | |||
| 92 | 96 | }); | |
| 93 | 97 | }); | |
| 94 | 98 | } | |
| 99 | + // #31179 | ||
| 100 | + var expected = Promise.all(undefined); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,7 @@ async function countEverything(): Promise<number> { | |||
| 43 | 43 | providerB(), | |
| 44 | 44 | >providerB : Symbol(providerB, Decl(correctOrderOfPromiseMethod.ts, 11, 9)) | |
| 45 | 45 | ||
| 46 | - ] as const); | ||
| 46 | + ]); | ||
| 47 | 47 | ||
| 48 | 48 | const dataA: A[] = resultA; | |
| 49 | 49 | >dataA : Symbol(dataA, Decl(correctOrderOfPromiseMethod.ts, 18, 9)) | |
@@ -70,3 +70,13 @@ async function countEverything(): Promise<number> { | |||
| 70 | 70 | return 0; | |
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | + // #31179 | ||
| 74 | + | ||
| 75 | + const expected: Promise<['a', 'b', 'c']> = Promise.all(undefined as readonly ['a', 'b', 'c']); | ||
| 76 | + >expected : Symbol(expected, Decl(correctOrderOfPromiseMethod.ts, 28, 5)) | ||
| 77 | + >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, --, --)) | ||
| 78 | + >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) | ||
| 79 | + >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, --, --)) | ||
| 80 | + >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) | ||
| 81 | + >undefined : Symbol(undefined) | ||
| 82 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,13 +28,12 @@ async function countEverything(): Promise<number> { | |||
| 28 | 28 | const [resultA, resultB] = await Promise.all([ | |
| 29 | 29 | >resultA : A[] | |
| 30 | 30 | >resultB : B[] | |
| 31 | - >await Promise.all([ providerA(), providerB(), ] as const) : [A[], B[]] | ||
| 32 | - >Promise.all([ providerA(), providerB(), ] as const) : Promise<[A[], B[]]> | ||
| 31 | + >await Promise.all([ providerA(), providerB(), ]) : [A[], B[]] | ||
| 32 | + >Promise.all([ providerA(), providerB(), ]) : Promise<[A[], B[]]> | ||
| 33 | 33 | >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[]>; } | |
| 34 | 34 | >Promise : PromiseConstructor | |
| 35 | 35 | >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[]>; } | |
| 36 | - >[ providerA(), providerB(), ] as const : readonly [Promise<A[]>, Promise<B[]>] | ||
| 37 | - >[ providerA(), providerB(), ] : readonly [Promise<A[]>, Promise<B[]>] | ||
| 36 | + >[ providerA(), providerB(), ] : [Promise<A[]>, Promise<B[]>] | ||
| 38 | 37 | ||
| 39 | 38 | providerA(), | |
| 40 | 39 | >providerA() : Promise<A[]> | |
@@ -44,7 +43,7 @@ async function countEverything(): Promise<number> { | |||
| 44 | 43 | >providerB() : Promise<B[]> | |
| 45 | 44 | >providerB : () => Promise<B[]> | |
| 46 | 45 | ||
| 47 | - ] as const); | ||
| 46 | + ]); | ||
| 48 | 47 | ||
| 49 | 48 | const dataA: A[] = resultA; | |
| 50 | 49 | >dataA : A[] | |
@@ -72,3 +71,14 @@ async function countEverything(): Promise<number> { | |||
| 72 | 71 | >0 : 0 | |
| 73 | 72 | } | |
| 74 | 73 | ||
| 74 | + // #31179 | ||
| 75 | + | ||
| 76 | + const expected: Promise<['a', 'b', 'c']> = Promise.all(undefined as readonly ['a', 'b', 'c']); | ||
| 77 | + >expected : Promise<["a", "b", "c"]> | ||
| 78 | + >Promise.all(undefined as readonly ['a', 'b', 'c']) : Promise<["a", "b", "c"]> | ||
| 79 | + >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[]>; } | ||
| 80 | + >Promise : PromiseConstructor | ||
| 81 | + >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[]>; } | ||
| 82 | + >undefined as readonly ['a', 'b', 'c'] : readonly ["a", "b", "c"] | ||
| 83 | + >undefined : undefined | ||
| 84 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,15 @@ var zipResult = zip(["foo", "bar"], [5, 6]); | |||
| 23 | 23 | var zipResultEle = zipResult[0]; // [string, number] | |
| 24 | 24 | var zipResultEleEle = zipResult[0][0]; // string | |
| 25 | 25 | ||
| 26 | + // #33559 and #33752 | ||
| 27 | + | ||
| 28 | + interface I<T> {} | ||
| 29 | + declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1; | ||
| 30 | + declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1; | ||
| 31 | + | ||
| 32 | + let expected: 'a'; | ||
| 33 | + expected = f1(undefined as [I<'a'>, I<'b'>]); | ||
| 34 | + expected = f2(undefined as [I<'a'>, I<'b'>]); | ||
| 26 | 35 | ||
| 27 | 36 | ||
| 28 | 37 | //// [typeInferenceWithTupleType.js] | |
@@ -46,3 +55,6 @@ function zip(array1, array2) { | |||
| 46 | 55 | var zipResult = zip(["foo", "bar"], [5, 6]); | |
| 47 | 56 | var zipResultEle = zipResult[0]; // [string, number] | |
| 48 | 57 | var zipResultEleEle = zipResult[0][0]; // string | |
| 58 | + var expected; | ||
| 59 | + expected = f1(undefined); | ||
| 60 | + expected = f2(undefined); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,4 +97,48 @@ var zipResultEleEle = zipResult[0][0]; // string | |||
| 97 | 97 | >0 : Symbol(0) | |
| 98 | 98 | >0 : Symbol(0) | |
| 99 | 99 | ||
| 100 | + // #33559 and #33752 | ||
| 101 | + | ||
| 102 | + interface I<T> {} | ||
| 103 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 104 | + >T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 26, 12)) | ||
| 105 | + | ||
| 106 | + declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1; | ||
| 107 | + >f1 : Symbol(f1, Decl(typeInferenceWithTupleType.ts, 26, 17)) | ||
| 108 | + >T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20)) | ||
| 109 | + >T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 27, 23)) | ||
| 110 | + >values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 27, 28)) | ||
| 111 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 112 | + >T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20)) | ||
| 113 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 114 | + >T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 27, 23)) | ||
| 115 | + >T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20)) | ||
| 116 | + | ||
| 117 | + declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1; | ||
| 118 | + >f2 : Symbol(f2, Decl(typeInferenceWithTupleType.ts, 27, 56)) | ||
| 119 | + >T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 28, 20)) | ||
| 120 | + >T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 28, 23)) | ||
| 121 | + >values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 28, 28)) | ||
| 122 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 123 | + >T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 28, 20)) | ||
| 124 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 125 | + >T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 28, 23)) | ||
| 126 | + >T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 28, 20)) | ||
| 127 | + | ||
| 128 | + let expected: 'a'; | ||
| 129 | + >expected : Symbol(expected, Decl(typeInferenceWithTupleType.ts, 30, 3)) | ||
| 130 | + | ||
| 131 | + expected = f1(undefined as [I<'a'>, I<'b'>]); | ||
| 132 | + >expected : Symbol(expected, Decl(typeInferenceWithTupleType.ts, 30, 3)) | ||
| 133 | + >f1 : Symbol(f1, Decl(typeInferenceWithTupleType.ts, 26, 17)) | ||
| 134 | + >undefined : Symbol(undefined) | ||
| 135 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 136 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 137 | + | ||
| 138 | + expected = f2(undefined as [I<'a'>, I<'b'>]); | ||
| 139 | + >expected : Symbol(expected, Decl(typeInferenceWithTupleType.ts, 30, 3)) | ||
| 140 | + >f2 : Symbol(f2, Decl(typeInferenceWithTupleType.ts, 27, 56)) | ||
| 141 | + >undefined : Symbol(undefined) | ||
| 142 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 143 | + >I : Symbol(I, Decl(typeInferenceWithTupleType.ts, 22, 38)) | ||
| 100 | 144 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,4 +109,33 @@ var zipResultEleEle = zipResult[0][0]; // string | |||
| 109 | 109 | >0 : 0 | |
| 110 | 110 | >0 : 0 | |
| 111 | 111 | ||
| 112 | + // #33559 and #33752 | ||
| 113 | + | ||
| 114 | + interface I<T> {} | ||
| 115 | + declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1; | ||
| 116 | + >f1 : <T1, T2>(values: [I<T1>, I<T2>]) => T1 | ||
| 117 | + >values : [I<T1>, I<T2>] | ||
| 118 | + | ||
| 119 | + declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1; | ||
| 120 | + >f2 : <T1, T2>(values: readonly [I<T1>, I<T2>]) => T1 | ||
| 121 | + >values : readonly [I<T1>, I<T2>] | ||
| 122 | + | ||
| 123 | + let expected: 'a'; | ||
| 124 | + >expected : "a" | ||
| 125 | + | ||
| 126 | + expected = f1(undefined as [I<'a'>, I<'b'>]); | ||
| 127 | + >expected = f1(undefined as [I<'a'>, I<'b'>]) : "a" | ||
| 128 | + >expected : "a" | ||
| 129 | + >f1(undefined as [I<'a'>, I<'b'>]) : "a" | ||
| 130 | + >f1 : <T1, T2>(values: [I<T1>, I<T2>]) => T1 | ||
| 131 | + >undefined as [I<'a'>, I<'b'>] : [I<"a">, I<"b">] | ||
| 132 | + >undefined : undefined | ||
| 133 | + | ||
| 134 | + expected = f2(undefined as [I<'a'>, I<'b'>]); | ||
| 135 | + >expected = f2(undefined as [I<'a'>, I<'b'>]) : "a" | ||
| 136 | + >expected : "a" | ||
| 137 | + >f2(undefined as [I<'a'>, I<'b'>]) : "a" | ||
| 138 | + >f2 : <T1, T2>(values: readonly [I<T1>, I<T2>]) => T1 | ||
| 139 | + >undefined as [I<'a'>, I<'b'>] : [I<"a">, I<"b">] | ||
| 140 | + >undefined : undefined | ||
| 112 | 141 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ async function countEverything(): Promise<number> { | |||
| 17 | 17 | const [resultA, resultB] = await Promise.all([ | |
| 18 | 18 | providerA(), | |
| 19 | 19 | providerB(), | |
| 20 | - ] as const); | ||
| 20 | + ]); | ||
| 21 | 21 | ||
| 22 | 22 | const dataA: A[] = resultA; | |
| 23 | 23 | const dataB: B[] = resultB; | |
@@ -26,3 +26,7 @@ async function countEverything(): Promise<number> { | |||
| 26 | 26 | } | |
| 27 | 27 | return 0; | |
| 28 | 28 | } | |
| 29 | + | ||
| 30 | + // #31179 | ||
| 31 | + | ||
| 32 | + const expected: Promise<['a', 'b', 'c']> = Promise.all(undefined as readonly ['a', 'b', 'c']); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - function combine<T, U>(x: T, y: U): [T, U] { | ||
| 1 | + function combine<T, U>(x: T, y: U): [T, U] { | ||
| 2 | 2 | return [x, y]; | |
| 3 | 3 | } | |
| 4 | 4 | ||
@@ -22,3 +22,12 @@ var zipResult = zip(["foo", "bar"], [5, 6]); | |||
| 22 | 22 | var zipResultEle = zipResult[0]; // [string, number] | |
| 23 | 23 | var zipResultEleEle = zipResult[0][0]; // string | |
| 24 | 24 | ||
| 25 | + // #33559 and #33752 | ||
| 26 | + | ||
| 27 | + interface I<T> {} | ||
| 28 | + declare function f1<T1, T2>(values: [I<T1>, I<T2>]): T1; | ||
| 29 | + declare function f2<T1, T2>(values: readonly [I<T1>, I<T2>]): T1; | ||
| 30 | + | ||
| 31 | + let expected: 'a'; | ||
| 32 | + expected = f1(undefined as [I<'a'>, I<'b'>]); | ||
| 33 | + expected = f2(undefined as [I<'a'>, I<'b'>]); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments