| 282 | ) => 'test' |
| 283 | |
| 284 | function Test<TDataType extends DataType>(props: { |
| 285 | dataType: TDataType |
| 286 | }) { |
| 287 | const { data } = useQuery(() => ({ |
| 288 | queryKey: ['test'], |
| 289 | queryFn: () => getData(props.dataType), |
| 290 | })) |
| 291 | |
| 292 | // Regression guard: this call must compile. With the previous |
| 293 | // hand-rolled NoInfer, `data` failed to flow back into the generic |
| 294 | // indexed-access parameter `DataTypeToEntity[TDataType]`. |
| 295 | return data ? getLabel(props.dataType, data) : null |
| 296 | } |
| 297 | |
| 298 | expectTypeOf(Test).toBeFunction() |
| 299 | }) |