diff --git a/packages/nuxt/src/app/composables/fetch.ts b/packages/nuxt/src/app/composables/fetch.ts index 5ce5a87d1f..4d5671f16e 100644 --- a/packages/nuxt/src/app/composables/fetch.ts +++ b/packages/nuxt/src/app/composables/fetch.ts @@ -27,18 +27,22 @@ interface NitroFetchOptions> = ComputedOptions> -export interface UseFetchOptions< +export type UseFetchOptions< ResT, DataT = ResT, PickKeys extends KeysOf = KeysOf, DefaultT = undefined, R extends NitroFetchRequest = string & {}, M extends AvailableRouterMethod = AvailableRouterMethod, -> extends Omit, 'watch'>, ComputedFetchOptions { - key?: string - $fetch?: typeof globalThis.$fetch - watch?: MultiWatchSources | false -} +> = Omit, 'watch'> & + (M extends 'GET' | 'get' + ? Omit, 'body'> + : ComputedFetchOptions + ) & { + key?: string + $fetch?: typeof globalThis.$fetch + watch?: MultiWatchSources | false + } /** * Fetch data from an API endpoint with an SSR-friendly composable.