|
| 1 | +//// [tests/cases/compiler/homomorphicMappedTypeReinstantiation.ts] //// |
| 2 | + |
| 3 | +=== homomorphicMappedTypeReinstantiation.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/65560 |
| 5 | + |
| 6 | +declare function either<A, B>(a: A, b: B): A | B; |
| 7 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 8 | +>A : Symbol(A, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 24)) |
| 9 | +>B : Symbol(B, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 26)) |
| 10 | +>a : Symbol(a, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 30)) |
| 11 | +>A : Symbol(A, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 24)) |
| 12 | +>b : Symbol(b, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 35)) |
| 13 | +>B : Symbol(B, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 26)) |
| 14 | +>A : Symbol(A, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 24)) |
| 15 | +>B : Symbol(B, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 26)) |
| 16 | + |
| 17 | +type Options = Partial<{ verbose: boolean }>; |
| 18 | +>Options : Symbol(Options, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 49)) |
| 19 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 20 | +>verbose : Symbol(verbose, Decl(homomorphicMappedTypeReinstantiation.ts, 4, 24)) |
| 21 | + |
| 22 | +declare const options: (Options | string)[]; |
| 23 | +>options : Symbol(options, Decl(homomorphicMappedTypeReinstantiation.ts, 5, 13)) |
| 24 | +>Options : Symbol(Options, Decl(homomorphicMappedTypeReinstantiation.ts, 2, 49)) |
| 25 | + |
| 26 | +const r1 = either(options[0], options.map(value => value)[0]); |
| 27 | +>r1 : Symbol(r1, Decl(homomorphicMappedTypeReinstantiation.ts, 6, 5)) |
| 28 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 29 | +>options : Symbol(options, Decl(homomorphicMappedTypeReinstantiation.ts, 5, 13)) |
| 30 | +>options.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 31 | +>options : Symbol(options, Decl(homomorphicMappedTypeReinstantiation.ts, 5, 13)) |
| 32 | +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 33 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 6, 42)) |
| 34 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 6, 42)) |
| 35 | + |
| 36 | +type ReadonlyOptions = Readonly<{ verbose: boolean }>; |
| 37 | +>ReadonlyOptions : Symbol(ReadonlyOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 6, 62)) |
| 38 | +>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --)) |
| 39 | +>verbose : Symbol(verbose, Decl(homomorphicMappedTypeReinstantiation.ts, 8, 33)) |
| 40 | + |
| 41 | +declare const readonlyOptions: (ReadonlyOptions | string)[]; |
| 42 | +>readonlyOptions : Symbol(readonlyOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 9, 13)) |
| 43 | +>ReadonlyOptions : Symbol(ReadonlyOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 6, 62)) |
| 44 | + |
| 45 | +const r2 = either(readonlyOptions[0], readonlyOptions.map(value => value)[0]); |
| 46 | +>r2 : Symbol(r2, Decl(homomorphicMappedTypeReinstantiation.ts, 10, 5)) |
| 47 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 48 | +>readonlyOptions : Symbol(readonlyOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 9, 13)) |
| 49 | +>readonlyOptions.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 50 | +>readonlyOptions : Symbol(readonlyOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 9, 13)) |
| 51 | +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 52 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 10, 58)) |
| 53 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 10, 58)) |
| 54 | + |
| 55 | +type Nullable<T> = { [K in keyof T]: T[K] | null }; |
| 56 | +>Nullable : Symbol(Nullable, Decl(homomorphicMappedTypeReinstantiation.ts, 10, 78)) |
| 57 | +>T : Symbol(T, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 14)) |
| 58 | +>K : Symbol(K, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 22)) |
| 59 | +>T : Symbol(T, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 14)) |
| 60 | +>T : Symbol(T, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 14)) |
| 61 | +>K : Symbol(K, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 22)) |
| 62 | + |
| 63 | +type NullableOptions = Nullable<{ verbose: boolean }>; |
| 64 | +>NullableOptions : Symbol(NullableOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 51)) |
| 65 | +>Nullable : Symbol(Nullable, Decl(homomorphicMappedTypeReinstantiation.ts, 10, 78)) |
| 66 | +>verbose : Symbol(verbose, Decl(homomorphicMappedTypeReinstantiation.ts, 13, 33)) |
| 67 | + |
| 68 | +declare const nullableOptions: (NullableOptions | string)[]; |
| 69 | +>nullableOptions : Symbol(nullableOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 14, 13)) |
| 70 | +>NullableOptions : Symbol(NullableOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 12, 51)) |
| 71 | + |
| 72 | +const r3 = either(nullableOptions[0], nullableOptions.map(value => value)[0]); |
| 73 | +>r3 : Symbol(r3, Decl(homomorphicMappedTypeReinstantiation.ts, 15, 5)) |
| 74 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 75 | +>nullableOptions : Symbol(nullableOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 14, 13)) |
| 76 | +>nullableOptions.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 77 | +>nullableOptions : Symbol(nullableOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 14, 13)) |
| 78 | +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 79 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 15, 58)) |
| 80 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 15, 58)) |
| 81 | + |
| 82 | +declare const unionOptions: (Partial<{ a: boolean } | { b: string }> | string)[]; |
| 83 | +>unionOptions : Symbol(unionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 17, 13)) |
| 84 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 85 | +>a : Symbol(a, Decl(homomorphicMappedTypeReinstantiation.ts, 17, 38)) |
| 86 | +>b : Symbol(b, Decl(homomorphicMappedTypeReinstantiation.ts, 17, 55)) |
| 87 | + |
| 88 | +const r4 = either(unionOptions[0], unionOptions.map(value => value)[0]); |
| 89 | +>r4 : Symbol(r4, Decl(homomorphicMappedTypeReinstantiation.ts, 18, 5)) |
| 90 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 91 | +>unionOptions : Symbol(unionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 17, 13)) |
| 92 | +>unionOptions.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 93 | +>unionOptions : Symbol(unionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 17, 13)) |
| 94 | +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 95 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 18, 52)) |
| 96 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 18, 52)) |
| 97 | + |
| 98 | +type AliasedUnionOptions = Partial<{ a: boolean } | { b: string }>; |
| 99 | +>AliasedUnionOptions : Symbol(AliasedUnionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 18, 72)) |
| 100 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 101 | +>a : Symbol(a, Decl(homomorphicMappedTypeReinstantiation.ts, 20, 36)) |
| 102 | +>b : Symbol(b, Decl(homomorphicMappedTypeReinstantiation.ts, 20, 53)) |
| 103 | + |
| 104 | +declare const aliasedUnionOptions: (AliasedUnionOptions | string)[]; |
| 105 | +>aliasedUnionOptions : Symbol(aliasedUnionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 21, 13)) |
| 106 | +>AliasedUnionOptions : Symbol(AliasedUnionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 18, 72)) |
| 107 | + |
| 108 | +const r5 = either(aliasedUnionOptions[0], aliasedUnionOptions.map(value => value)[0]); |
| 109 | +>r5 : Symbol(r5, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 5)) |
| 110 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 111 | +>aliasedUnionOptions : Symbol(aliasedUnionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 21, 13)) |
| 112 | +>aliasedUnionOptions.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 113 | +>aliasedUnionOptions : Symbol(aliasedUnionOptions, Decl(homomorphicMappedTypeReinstantiation.ts, 21, 13)) |
| 114 | +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) |
| 115 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 66)) |
| 116 | +>value : Symbol(value, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 66)) |
| 117 | + |
| 118 | +type Named = { verbose: boolean }; |
| 119 | +>Named : Symbol(Named, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 86)) |
| 120 | +>verbose : Symbol(verbose, Decl(homomorphicMappedTypeReinstantiation.ts, 24, 14)) |
| 121 | + |
| 122 | +type A1 = Partial<Named>; |
| 123 | +>A1 : Symbol(A1, Decl(homomorphicMappedTypeReinstantiation.ts, 24, 34)) |
| 124 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 125 | +>Named : Symbol(Named, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 86)) |
| 126 | + |
| 127 | +type A2 = Partial<Named>; |
| 128 | +>A2 : Symbol(A2, Decl(homomorphicMappedTypeReinstantiation.ts, 25, 25)) |
| 129 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 130 | +>Named : Symbol(Named, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 86)) |
| 131 | + |
| 132 | +declare const a1: A1; |
| 133 | +>a1 : Symbol(a1, Decl(homomorphicMappedTypeReinstantiation.ts, 27, 13)) |
| 134 | +>A1 : Symbol(A1, Decl(homomorphicMappedTypeReinstantiation.ts, 24, 34)) |
| 135 | + |
| 136 | +declare const a2: A2; |
| 137 | +>a2 : Symbol(a2, Decl(homomorphicMappedTypeReinstantiation.ts, 28, 13)) |
| 138 | +>A2 : Symbol(A2, Decl(homomorphicMappedTypeReinstantiation.ts, 25, 25)) |
| 139 | + |
| 140 | +declare const a3: Partial<Named>; |
| 141 | +>a3 : Symbol(a3, Decl(homomorphicMappedTypeReinstantiation.ts, 29, 13)) |
| 142 | +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) |
| 143 | +>Named : Symbol(Named, Decl(homomorphicMappedTypeReinstantiation.ts, 22, 86)) |
| 144 | + |
| 145 | +const r6 = either(a1, a2); |
| 146 | +>r6 : Symbol(r6, Decl(homomorphicMappedTypeReinstantiation.ts, 30, 5)) |
| 147 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 148 | +>a1 : Symbol(a1, Decl(homomorphicMappedTypeReinstantiation.ts, 27, 13)) |
| 149 | +>a2 : Symbol(a2, Decl(homomorphicMappedTypeReinstantiation.ts, 28, 13)) |
| 150 | + |
| 151 | +const r7 = either(a1, a3); |
| 152 | +>r7 : Symbol(r7, Decl(homomorphicMappedTypeReinstantiation.ts, 31, 5)) |
| 153 | +>either : Symbol(either, Decl(homomorphicMappedTypeReinstantiation.ts, 0, 0)) |
| 154 | +>a1 : Symbol(a1, Decl(homomorphicMappedTypeReinstantiation.ts, 27, 13)) |
| 155 | +>a3 : Symbol(a3, Decl(homomorphicMappedTypeReinstantiation.ts, 29, 13)) |
| 156 | + |
0 commit comments