Skip to content

Commit

Permalink
fix: correct return type of useRequestFetch (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
wattanx authored Dec 5, 2024
1 parent b58a2e8 commit a524ddd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/bridge/src/runtime/composables/ssr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { H3Event } from 'h3'
import type { NuxtAppCompat } from '@nuxt/bridge-schema'
import { getRequestHeaders, createEvent } from 'h3'
import type { H3Event$Fetch } from 'nitropack'
import { useNuxtApp } from '../nuxt'

export function useRequestHeaders<K extends string = string> (include: K[]): { [key in Lowercase<K>]?: string }
Expand All @@ -26,9 +27,9 @@ export function useRequestEvent (nuxtApp: NuxtAppCompat = useNuxtApp()): H3Event
return nuxtApp.ssrContext._event
}

export function useRequestFetch (): typeof global.$fetch {
export function useRequestFetch (): H3Event$Fetch | typeof global.$fetch {
if (process.client) {
return globalThis.$fetch
}
return useRequestEvent()?.$fetch as typeof globalThis.$fetch || globalThis.$fetch
return useRequestEvent()?.$fetch || globalThis.$fetch
}

0 comments on commit a524ddd

Please sign in to comment.