export type PromiseOrValue = T | Promise; export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; export type KeysEnum = { [P in keyof Required]: true; }; export type FinalizedRequestInit = RequestInit & { headers: Headers; }; type NotAny = [0] extends [1 & T] ? never : T; /** * Some environments overload the global fetch function, and Parameters only gets the last signature. */ type OverloadedParameters = T extends ({ (...args: infer A): unknown; (...args: infer B): unknown; (...args: infer C): unknown; (...args: infer D): unknown; }) ? A | B | C | D : T extends ({ (...args: infer A): unknown; (...args: infer B): unknown; (...args: infer C): unknown; }) ? A | B | C : T extends ({ (...args: infer A): unknown; (...args: infer B): unknown; }) ? A | B : T extends (...args: infer A) => unknown ? A : never; /** * These imports attempt to get types from a parent package's dependencies. * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which * would cause typescript to show types not present at runtime. To avoid this, we import * directly from parent node_modules folders. * * We need to check multiple levels because we don't know what directory structure we'll be in. * For example, pnpm generates directories like this: * ``` * node_modules * ├── .pnpm * │ └── pkg@1.0.0 * │ └── node_modules * │ └── pkg * │ └── internal * │ └── types.d.ts * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg * └── undici * ``` * * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition */ /** @ts-ignore For users with \@types/node */ type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with undici */ type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with \@types/bun */ type BunRequestInit = globalThis.FetchRequestInit; /** @ts-ignore For users with node-fetch@2 */ type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users who use Deno */ type FetchRequestInit = NonNullable[1]>; type RequestInits = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** * This type contains `RequestInit` options that may be available on the current runtime, * including per-platform extensions like `dispatcher`, `agent`, `client`, etc. */ export type MergedRequestInit = RequestInits & /** We don't include these in the types as they'll be overridden for every request. */ Partial>; export {}; //# sourceMappingURL=types.d.ts.map