| 291 | ) => 'test' |
| 292 | |
| 293 | function Test<TDataType extends DataType>(props: { |
| 294 | dataType: TDataType |
| 295 | }) { |
| 296 | const { data } = useQuery(() => ({ |
| 297 | queryKey: ['test'], |
| 298 | queryFn: () => getData(props.dataType), |
| 299 | })) |
| 300 | |
| 301 | // Regression guard: this call must compile. With the previous |
| 302 | // hand-rolled NoInfer, `data` failed to flow back into the generic |
| 303 | // indexed-access parameter `DataTypeToEntity[TDataType]`. |
| 304 | return data ? getLabel(props.dataType, data) : null |
| 305 | } |
| 306 | |
| 307 | expectTypeOf(Test).toBeFunction() |
| 308 | }) |