GeezerVison is showing github.com — Add tests · microsoft/TypeScript@5399ce0
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: tests/baselines/reference/correctOrderOfPromiseMethod.js +7-1Lines changed: 7 additions & 1 deletion | 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 result: Promise<[0, 1, '']> = Promise.all(undefined as readonly [0, 1, '']); | 27 | 31 |
| 28 | 32 |
| 29 | 33 | //// [correctOrderOfPromiseMethod.js] | @@ -92,3 +96,5 @@ function countEverything() { | 92 | 96 | }); | 93 | 97 | }); | 94 | 98 | } | | 99 | +// #31179 | | 100 | +var result = Promise.all(undefined); |
Collapse file Copy file name to clipboardExpand all lines: tests/baselines/reference/correctOrderOfPromiseMethod.symbols +11-1Lines changed: 11 additions & 1 deletion | 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 result: Promise<[0, 1, '']> = Promise.all(undefined as readonly [0, 1, '']); | | 76 | +>result : Symbol(result, 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 | + |
Collapse file Copy file name to clipboardExpand all lines: tests/baselines/reference/correctOrderOfPromiseMethod.types +15-5Lines changed: 15 additions & 5 deletions | 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 result: Promise<[0, 1, '']> = Promise.all(undefined as readonly [0, 1, '']); | | 77 | +>result : Promise<[0, 1, ""]> | | 78 | +>Promise.all(undefined as readonly [0, 1, '']) : Promise<[0, 1, ""]> | | 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 [0, 1, ''] : readonly [0, 1, ""] | | 83 | +>undefined : undefined | | 84 | + |
Collapse file Copy file name to clipboardExpand all lines: tests/baselines/reference/typeInferenceWithTupleType.js +12Lines changed: 12 additions & 0 deletions | 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 one: 1; | | 33 | +one = f1(undefined as [I<1>, I<number>]); | | 34 | +one = f2(undefined as [I<1>, I<number>]); | 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 one; | | 59 | +one = f1(undefined); | | 60 | +one = f2(undefined); |
Collapse file Copy file name to clipboardExpand all lines: tests/baselines/reference/typeInferenceWithTupleType.symbols +44Lines changed: 44 additions & 0 deletions | 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 one: 1; | | 129 | +>one : Symbol(one, Decl(typeInferenceWithTupleType.ts, 30, 3)) | | 130 | + | | 131 | +one = f1(undefined as [I<1>, I<number>]); | | 132 | +>one : Symbol(one, 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 | +one = f2(undefined as [I<1>, I<number>]); | | 139 | +>one : Symbol(one, 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 |
|
Collapse file Copy file name to clipboardExpand all lines: tests/baselines/reference/typeInferenceWithTupleType.types +29Lines changed: 29 additions & 0 deletions | 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 one: 1; | | 124 | +>one : 1 | | 125 | + | | 126 | +one = f1(undefined as [I<1>, I<number>]); | | 127 | +>one = f1(undefined as [I<1>, I<number>]) : 1 | | 128 | +>one : 1 | | 129 | +>f1(undefined as [I<1>, I<number>]) : 1 | | 130 | +>f1 : <T1, T2>(values: [I<T1>, I<T2>]) => T1 | | 131 | +>undefined as [I<1>, I<number>] : [I<1>, I<number>] | | 132 | +>undefined : undefined | | 133 | + | | 134 | +one = f2(undefined as [I<1>, I<number>]); | | 135 | +>one = f2(undefined as [I<1>, I<number>]) : 1 | | 136 | +>one : 1 | | 137 | +>f2(undefined as [I<1>, I<number>]) : 1 | | 138 | +>f2 : <T1, T2>(values: readonly [I<T1>, I<T2>]) => T1 | | 139 | +>undefined as [I<1>, I<number>] : [I<1>, I<number>] | | 140 | +>undefined : undefined | 112 | 141 |
|
Collapse file Copy file name to clipboardExpand all lines: tests/cases/compiler/correctOrderOfPromiseMethod.ts +5-1Lines changed: 5 additions & 1 deletion | 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 result: Promise<[0, 1, '']> = Promise.all(undefined as readonly [0, 1, '']); |
Collapse file Copy file name to clipboardExpand all lines: tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts +10-1Lines changed: 10 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 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 one: 1; | | 32 | +one = f1(undefined as [I<1>, I<number>]); | | 33 | +one = f2(undefined as [I<1>, I<number>]); |
|