|
1 | 1 | //// [tests/cases/compiler/typeInferenceIndexingUsingOtherTypeParameter1.ts] //// |
2 | 2 |
|
3 | 3 | === typeInferenceIndexingUsingOtherTypeParameter1.ts === |
4 | | -type Primitive = null | undefined | string | number | boolean | symbol | bigint; |
5 | | ->Primitive : Symbol(Primitive, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
6 | | - |
7 | 4 | type FieldValues = Record<string, any>; |
8 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
| 5 | +>FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
9 | 6 | >Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) |
10 | 7 |
|
11 | | -type PathImpl< |
12 | | ->PathImpl : Symbol(PathImpl, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 2, 39)) |
13 | | - |
14 | | - K extends string | number, |
15 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 4, 14)) |
16 | | - |
17 | | - V, |
18 | | ->V : Symbol(V, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 5, 28)) |
19 | | - |
20 | | - TraversedTypes, |
21 | | ->TraversedTypes : Symbol(TraversedTypes, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 6, 4)) |
22 | | - |
23 | | -> = V extends Primitive |
24 | | ->V : Symbol(V, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 5, 28)) |
25 | | ->Primitive : Symbol(Primitive, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
26 | | - |
27 | | - ? `${K}` |
28 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 4, 14)) |
29 | | - |
30 | | - : `${K}` | `${K}.${PathInternal<V, TraversedTypes | V>}`; |
31 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 4, 14)) |
32 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 4, 14)) |
33 | | ->PathInternal : Symbol(PathInternal, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 59)) |
34 | | ->V : Symbol(V, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 5, 28)) |
35 | | ->TraversedTypes : Symbol(TraversedTypes, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 6, 4)) |
36 | | ->V : Symbol(V, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 5, 28)) |
37 | | - |
38 | | -type PathInternal<T, TraversedTypes = T> = { |
39 | | ->PathInternal : Symbol(PathInternal, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 59)) |
40 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 18)) |
41 | | ->TraversedTypes : Symbol(TraversedTypes, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 20)) |
42 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 18)) |
43 | | - |
44 | | - [K in keyof T]-?: PathImpl<K & string, T[K], TraversedTypes>; |
45 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 13, 3)) |
46 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 18)) |
47 | | ->PathImpl : Symbol(PathImpl, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 2, 39)) |
48 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 13, 3)) |
49 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 18)) |
50 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 13, 3)) |
51 | | ->TraversedTypes : Symbol(TraversedTypes, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 20)) |
52 | | - |
53 | | -}[keyof T]; |
54 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 12, 18)) |
55 | | - |
56 | | -type Path<T> = T extends any ? PathInternal<T> : never; |
57 | | ->Path : Symbol(Path, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 14, 11)) |
58 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 10)) |
59 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 10)) |
60 | | ->PathInternal : Symbol(PathInternal, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 59)) |
61 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 10)) |
62 | | - |
63 | | -type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>; |
64 | | ->FieldPath : Symbol(FieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 55)) |
65 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 18, 15)) |
66 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
67 | | ->Path : Symbol(Path, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 14, 11)) |
68 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 18, 15)) |
69 | | - |
70 | | -type PathValue<T, P extends Path<T>> = T extends any |
71 | | ->PathValue : Symbol(PathValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 18, 70)) |
72 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
73 | | ->P : Symbol(P, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 17)) |
74 | | ->Path : Symbol(Path, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 14, 11)) |
75 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
76 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
77 | | - |
78 | | - ? P extends `${infer K}.${infer R}` |
79 | | ->P : Symbol(P, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 17)) |
80 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 22)) |
81 | | ->R : Symbol(R, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 33)) |
82 | | - |
83 | | - ? K extends keyof T |
84 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 22)) |
85 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
86 | | - |
87 | | - ? R extends Path<T[K]> |
88 | | ->R : Symbol(R, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 33)) |
89 | | ->Path : Symbol(Path, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 14, 11)) |
90 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
91 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 22)) |
92 | | - |
93 | | - ? PathValue<T[K], R> |
94 | | ->PathValue : Symbol(PathValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 18, 70)) |
95 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
96 | | ->K : Symbol(K, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 22)) |
97 | | ->R : Symbol(R, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 21, 33)) |
98 | | - |
99 | | - : never |
100 | | - : never |
101 | | - : P extends keyof T |
102 | | ->P : Symbol(P, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 17)) |
103 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
104 | | - |
105 | | - ? T[P] |
106 | | ->T : Symbol(T, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 15)) |
107 | | ->P : Symbol(P, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 20, 17)) |
108 | | - |
109 | | - : never |
110 | | - : never; |
111 | | - |
112 | | -type FieldPathValue< |
113 | | ->FieldPathValue : Symbol(FieldPathValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 30, 10)) |
114 | | - |
115 | | - TFieldValues extends FieldValues, |
116 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 32, 20)) |
117 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
118 | | - |
119 | | - TFieldPath extends FieldPath<TFieldValues>, |
120 | | ->TFieldPath : Symbol(TFieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 33, 35)) |
121 | | ->FieldPath : Symbol(FieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 55)) |
122 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 32, 20)) |
123 | | - |
124 | | -> = PathValue<TFieldValues, TFieldPath>; |
125 | | ->PathValue : Symbol(PathValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 18, 70)) |
126 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 32, 20)) |
127 | | ->TFieldPath : Symbol(TFieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 33, 35)) |
128 | | - |
129 | 8 | type UseControllerProps< |
130 | | ->UseControllerProps : Symbol(UseControllerProps, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 35, 40)) |
| 9 | +>UseControllerProps : Symbol(UseControllerProps, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 39)) |
131 | 10 |
|
132 | 11 | TFieldValues extends FieldValues = FieldValues, |
133 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 37, 24)) |
134 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
135 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
| 12 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 2, 24)) |
| 13 | +>FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
| 14 | +>FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
136 | 15 |
|
137 | | - TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, |
138 | | ->TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 38, 49)) |
139 | | ->FieldPath : Symbol(FieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 55)) |
140 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 37, 24)) |
141 | | ->FieldPath : Symbol(FieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 55)) |
142 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 37, 24)) |
| 16 | + TName extends keyof TFieldValues = keyof TFieldValues, |
| 17 | +>TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 3, 49)) |
| 18 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 2, 24)) |
| 19 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 2, 24)) |
143 | 20 |
|
144 | 21 | > = { |
145 | 22 | name: TName; |
146 | | ->name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 40, 5)) |
147 | | ->TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 38, 49)) |
| 23 | +>name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 5, 5)) |
| 24 | +>TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 3, 49)) |
148 | 25 |
|
149 | | - defaultValue?: FieldPathValue<TFieldValues, TName>; |
150 | | ->defaultValue : Symbol(defaultValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 41, 14)) |
151 | | ->FieldPathValue : Symbol(FieldPathValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 30, 10)) |
152 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 37, 24)) |
153 | | ->TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 38, 49)) |
| 26 | + defaultValue?: TFieldValues[TName]; |
| 27 | +>defaultValue : Symbol(defaultValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 6, 14)) |
| 28 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 2, 24)) |
| 29 | +>TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 3, 49)) |
154 | 30 |
|
155 | 31 | }; |
156 | 32 |
|
157 | 33 | declare function useController< |
158 | | ->useController : Symbol(useController, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 43, 2)) |
| 34 | +>useController : Symbol(useController, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 8, 2)) |
159 | 35 |
|
160 | 36 | TFieldValues extends FieldValues = FieldValues, |
161 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 45, 31)) |
162 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
163 | | ->FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 80)) |
| 37 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 31)) |
| 38 | +>FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
| 39 | +>FieldValues : Symbol(FieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 0)) |
164 | 40 |
|
165 | | - TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, |
166 | | ->TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 46, 49)) |
167 | | ->FieldPath : Symbol(FieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 55)) |
168 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 45, 31)) |
169 | | ->FieldPath : Symbol(FieldPath, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 16, 55)) |
170 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 45, 31)) |
| 41 | + TName extends keyof TFieldValues = keyof TFieldValues, |
| 42 | +>TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 11, 49)) |
| 43 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 31)) |
| 44 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 31)) |
171 | 45 |
|
172 | 46 | >( |
173 | 47 | props: UseControllerProps<TFieldValues, TName>, |
174 | | ->props : Symbol(props, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 48, 2)) |
175 | | ->UseControllerProps : Symbol(UseControllerProps, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 35, 40)) |
176 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 45, 31)) |
177 | | ->TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 46, 49)) |
| 48 | +>props : Symbol(props, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 13, 2)) |
| 49 | +>UseControllerProps : Symbol(UseControllerProps, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 0, 39)) |
| 50 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 31)) |
| 51 | +>TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 11, 49)) |
178 | 52 |
|
179 | 53 | ): { name: TName; values: TFieldValues }; |
180 | | ->name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 50, 4)) |
181 | | ->TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 46, 49)) |
182 | | ->values : Symbol(values, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 50, 17)) |
183 | | ->TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 45, 31)) |
| 54 | +>name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 15, 4)) |
| 55 | +>TName : Symbol(TName, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 11, 49)) |
| 56 | +>values : Symbol(values, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 15, 17)) |
| 57 | +>TFieldValues : Symbol(TFieldValues, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 10, 31)) |
184 | 58 |
|
185 | 59 | export const { name, values } = useController({ |
186 | | ->name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 52, 14)) |
187 | | ->values : Symbol(values, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 52, 20)) |
188 | | ->useController : Symbol(useController, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 43, 2)) |
| 60 | +>name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 17, 14)) |
| 61 | +>values : Symbol(values, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 17, 20)) |
| 62 | +>useController : Symbol(useController, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 8, 2)) |
189 | 63 |
|
190 | 64 | name: "test", |
191 | | ->name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 52, 47)) |
| 65 | +>name : Symbol(name, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 17, 47)) |
192 | 66 |
|
193 | 67 | defaultValue: "", |
194 | | ->defaultValue : Symbol(defaultValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 53, 15)) |
| 68 | +>defaultValue : Symbol(defaultValue, Decl(typeInferenceIndexingUsingOtherTypeParameter1.ts, 18, 15)) |
195 | 69 |
|
196 | 70 | }); |
197 | 71 |
|
0 commit comments