|
| 1 | +//// [tests/cases/compiler/inferToDistributiveConditionalTypeAndOtherTargets1.ts] //// |
| 2 | + |
| 3 | +=== inferToDistributiveConditionalTypeAndOtherTargets1.ts === |
| 4 | +type NonUndefinedGuard<T> = T extends undefined ? never : T; |
| 5 | +>NonUndefinedGuard : Symbol(NonUndefinedGuard, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 0, 0)) |
| 6 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 0, 23)) |
| 7 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 0, 23)) |
| 8 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 0, 23)) |
| 9 | + |
| 10 | +declare const RefSymbol: unique symbol; |
| 11 | +>RefSymbol : Symbol(RefSymbol, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 2, 13)) |
| 12 | + |
| 13 | +interface Ref<T = any, S = T> { |
| 14 | +>Ref : Symbol(Ref, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 2, 39)) |
| 15 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 14)) |
| 16 | +>S : Symbol(S, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 22)) |
| 17 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 14)) |
| 18 | + |
| 19 | + get value(): T; |
| 20 | +>value : Symbol(Ref.value, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 31), Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 5, 17)) |
| 21 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 14)) |
| 22 | + |
| 23 | + set value(_: S); |
| 24 | +>value : Symbol(Ref.value, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 31), Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 5, 17)) |
| 25 | +>_ : Symbol(_, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 6, 12)) |
| 26 | +>S : Symbol(S, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 4, 22)) |
| 27 | + |
| 28 | + [RefSymbol]: true; |
| 29 | +>[RefSymbol] : Symbol(Ref[RefSymbol], Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 6, 18)) |
| 30 | +>RefSymbol : Symbol(RefSymbol, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 2, 13)) |
| 31 | +} |
| 32 | + |
| 33 | +type MaybeRef<T> = Ref<T> | T; |
| 34 | +>MaybeRef : Symbol(MaybeRef, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 8, 1)) |
| 35 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 10, 14)) |
| 36 | +>Ref : Symbol(Ref, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 2, 39)) |
| 37 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 10, 14)) |
| 38 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 10, 14)) |
| 39 | + |
| 40 | +type MaybeRefDeep<T> = MaybeRef< |
| 41 | +>MaybeRefDeep : Symbol(MaybeRefDeep, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 10, 30)) |
| 42 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 43 | +>MaybeRef : Symbol(MaybeRef, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 8, 1)) |
| 44 | + |
| 45 | + T extends Function |
| 46 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 47 | +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 48 | + |
| 49 | + ? T |
| 50 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 51 | + |
| 52 | + : T extends object |
| 53 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 54 | + |
| 55 | + ? { |
| 56 | + [Property in keyof T]: MaybeRefDeep<T[Property]>; |
| 57 | +>Property : Symbol(Property, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 17, 9)) |
| 58 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 59 | +>MaybeRefDeep : Symbol(MaybeRefDeep, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 10, 30)) |
| 60 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 61 | +>Property : Symbol(Property, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 17, 9)) |
| 62 | + } |
| 63 | + : T |
| 64 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 12, 18)) |
| 65 | + |
| 66 | +>; |
| 67 | + |
| 68 | +type QueryFunction<T = unknown> = () => T | Promise<T>; |
| 69 | +>QueryFunction : Symbol(QueryFunction, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 20, 2)) |
| 70 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 22, 19)) |
| 71 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 22, 19)) |
| 72 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --)) |
| 73 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 22, 19)) |
| 74 | + |
| 75 | +type InitialDataFunction<T> = () => T | undefined; |
| 76 | +>InitialDataFunction : Symbol(InitialDataFunction, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 22, 55)) |
| 77 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 24, 25)) |
| 78 | +>T : Symbol(T, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 24, 25)) |
| 79 | + |
| 80 | +interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> { |
| 81 | +>QueryOptions : Symbol(QueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 24, 50)) |
| 82 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 23)) |
| 83 | +>TData : Symbol(TData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 46)) |
| 84 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 23)) |
| 85 | + |
| 86 | + queryFn?: QueryFunction<TQueryFnData>; |
| 87 | +>queryFn : Symbol(QueryOptions.queryFn, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 70)) |
| 88 | +>QueryFunction : Symbol(QueryFunction, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 20, 2)) |
| 89 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 23)) |
| 90 | + |
| 91 | + initialData?: TData | InitialDataFunction<TData>; |
| 92 | +>initialData : Symbol(QueryOptions.initialData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 27, 40)) |
| 93 | +>TData : Symbol(TData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 46)) |
| 94 | +>InitialDataFunction : Symbol(InitialDataFunction, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 22, 55)) |
| 95 | +>TData : Symbol(TData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 26, 46)) |
| 96 | +} |
| 97 | + |
| 98 | +type UseQueryOptions<TQueryFnData = unknown, TQueryData = TQueryFnData> = { |
| 99 | +>UseQueryOptions : Symbol(UseQueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 29, 1)) |
| 100 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 21)) |
| 101 | +>TQueryData : Symbol(TQueryData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 44)) |
| 102 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 21)) |
| 103 | + |
| 104 | + [Property in keyof QueryOptions<TQueryFnData, TQueryData>]: MaybeRefDeep< |
| 105 | +>Property : Symbol(Property, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 32, 3)) |
| 106 | +>QueryOptions : Symbol(QueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 24, 50)) |
| 107 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 21)) |
| 108 | +>TQueryData : Symbol(TQueryData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 44)) |
| 109 | +>MaybeRefDeep : Symbol(MaybeRefDeep, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 10, 30)) |
| 110 | + |
| 111 | + QueryOptions<TQueryFnData, TQueryData>[Property] |
| 112 | +>QueryOptions : Symbol(QueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 24, 50)) |
| 113 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 21)) |
| 114 | +>TQueryData : Symbol(TQueryData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 31, 44)) |
| 115 | +>Property : Symbol(Property, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 32, 3)) |
| 116 | + |
| 117 | + >; |
| 118 | +}; |
| 119 | + |
| 120 | +type DefinedInitialQueryOptions<TQueryFnData = unknown> = UseQueryOptions< |
| 121 | +>DefinedInitialQueryOptions : Symbol(DefinedInitialQueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 35, 2)) |
| 122 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 37, 32)) |
| 123 | +>UseQueryOptions : Symbol(UseQueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 29, 1)) |
| 124 | + |
| 125 | + TQueryFnData, |
| 126 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 37, 32)) |
| 127 | + |
| 128 | + TQueryFnData |
| 129 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 37, 32)) |
| 130 | + |
| 131 | +> & { |
| 132 | + initialData: |
| 133 | +>initialData : Symbol(initialData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 40, 5)) |
| 134 | + |
| 135 | + | NonUndefinedGuard<TQueryFnData> |
| 136 | +>NonUndefinedGuard : Symbol(NonUndefinedGuard, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 0, 0)) |
| 137 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 37, 32)) |
| 138 | + |
| 139 | + | (() => NonUndefinedGuard<TQueryFnData>); |
| 140 | +>NonUndefinedGuard : Symbol(NonUndefinedGuard, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 0, 0)) |
| 141 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 37, 32)) |
| 142 | + |
| 143 | +}; |
| 144 | + |
| 145 | +declare function queryOptions<TQueryFnData = unknown>( |
| 146 | +>queryOptions : Symbol(queryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 44, 2)) |
| 147 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 46, 30)) |
| 148 | + |
| 149 | + options: DefinedInitialQueryOptions<TQueryFnData>, |
| 150 | +>options : Symbol(options, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 46, 54)) |
| 151 | +>DefinedInitialQueryOptions : Symbol(DefinedInitialQueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 35, 2)) |
| 152 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 46, 30)) |
| 153 | + |
| 154 | +): DefinedInitialQueryOptions<TQueryFnData>; |
| 155 | +>DefinedInitialQueryOptions : Symbol(DefinedInitialQueryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 35, 2)) |
| 156 | +>TQueryFnData : Symbol(TQueryFnData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 46, 30)) |
| 157 | + |
| 158 | +const result = queryOptions({ |
| 159 | +>result : Symbol(result, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 50, 5)) |
| 160 | +>queryOptions : Symbol(queryOptions, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 44, 2)) |
| 161 | + |
| 162 | + initialData: () => ({ |
| 163 | +>initialData : Symbol(initialData, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 50, 29)) |
| 164 | + |
| 165 | + wow: true, |
| 166 | +>wow : Symbol(wow, Decl(inferToDistributiveConditionalTypeAndOtherTargets1.ts, 51, 23)) |
| 167 | + |
| 168 | + }), |
| 169 | +}); |
| 170 | + |
0 commit comments