fix(nuxt3): fix type inference for FetchResult (#1269)

This commit is contained in:
Daniel Roe 2021-10-20 10:43:08 +01:00 committed by GitHub
parent c49f9ca648
commit f950fe0d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,11 @@
import type { FetchOptions } from 'ohmyfetch' import type { FetchOptions, FetchRequest } from 'ohmyfetch'
import type { $Fetch } from '@nuxt/nitro' import type { $Fetch } from '@nuxt/nitro'
import { murmurHashV3 } from 'murmurhash-es' import { murmurHashV3 } from 'murmurhash-es'
import type { AsyncDataOptions, _Transform, KeyOfRes } from './asyncData' import type { AsyncDataOptions, _Transform, KeyOfRes } from './asyncData'
import { useAsyncData } from './asyncData' import { useAsyncData } from './asyncData'
export type Awaited<T> = T extends Promise<infer U> ? U : T export type Awaited<T> = T extends Promise<infer U> ? U : T
export type FetchResult<ReqT extends string> = Awaited<ReturnType<$Fetch<unknown, ReqT>>> export type FetchResult<ReqT extends FetchRequest> = Awaited<ReturnType<$Fetch<unknown, ReqT>>>
export type UseFetchOptions< export type UseFetchOptions<
DataT, DataT,