refactor(nuxt): explicitly type internal request fetch

This commit is contained in:
Daniel Roe 2025-03-04 13:08:46 +00:00
parent 3ec1a1e5e9
commit 2c5e6d5aa5
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -1,5 +1,5 @@
import type { FetchError, FetchOptions } from 'ofetch'
import type { NitroFetchRequest, TypedInternalResponse, AvailableRouterMethod as _AvailableRouterMethod } from 'nitro/types'
import type { $Fetch, H3Event$Fetch, NitroFetchRequest, TypedInternalResponse, AvailableRouterMethod as _AvailableRouterMethod } from 'nitro/types'
import type { MaybeRef, Ref } from 'vue'
import { computed, reactive, toValue } from 'vue'
import { hash } from 'ohash'
@ -168,7 +168,7 @@ export function useFetch<
controller.signal.onabort = () => clearTimeout(timeoutId)
}
let _$fetch = opts.$fetch || globalThis.$fetch
let _$fetch: H3Event$Fetch | $Fetch<unknown, NitroFetchRequest> = opts.$fetch || globalThis.$fetch
// Use fetch with request context and headers for server direct API calls
if (import.meta.server && !opts.$fetch) {