| 311 | ) => 'test' |
| 312 | |
| 313 | function Test<TDataType extends DataType>(props: { |
| 314 | dataType: TDataType |
| 315 | }) { |
| 316 | const query = useQuery(() => ({ |
| 317 | queryKey: ['test'], |
| 318 | queryFn: () => getData(props.dataType), |
| 319 | })) |
| 320 | |
| 321 | // Regression guard: this call must compile. With the previous |
| 322 | // hand-rolled NoInfer, `data` failed to flow back into the generic |
| 323 | // indexed-access parameter `DataTypeToEntity[TDataType]`. |
| 324 | return query.data ? getLabel(props.dataType, query.data) : null |
| 325 | } |
| 326 | |
| 327 | expectTypeOf(Test).toBeFunction() |
| 328 | }) |