diff --git a/src/types/fetch/fetch.ts b/src/types/fetch/fetch.ts index 2f0e2dd704..07251a82c5 100644 --- a/src/types/fetch/fetch.ts +++ b/src/types/fetch/fetch.ts @@ -5,14 +5,24 @@ import type { MatchedRoutes } from "./_match.ts"; // An interface to extend in a local project export interface InternalApi {} +// Opt-in configuration interface to augment in a local project, e.g. +// declare module "nitropack" { +// interface NitroFetchConfig { flatRequest: true } +// } +export interface NitroFetchConfig {} + // TODO: upgrade to uppercase for h3 v2 types and web consistency type RouterMethod = Lowercase; -export type NitroFetchRequest = +type TypedNitroFetchRequest = | Exclude | Exclude | (string & {}); +export type NitroFetchRequest = NitroFetchConfig extends { flatRequest: true } + ? string + : TypedNitroFetchRequest; + export type MiddlewareOf< Route extends string, Method extends RouterMethod | "default",