import * as OctokitTypes from "@octokit/types"; import { RequestError } from "@octokit/request-error"; import type { Octokit } from "./index.js"; export type RequestParameters = OctokitTypes.RequestParameters; export interface OctokitOptions { authStrategy?: any; auth?: any; userAgent?: string; previews?: string[]; baseUrl?: string; log?: { debug: (message: string) => unknown; info: (message: string) => unknown; warn: (message: string) => unknown; error: (message: string) => unknown; }; request?: OctokitTypes.RequestRequestOptions; timeZone?: string; [option: string]: any; } export type Constructor = new (...args: any[]) => T; export type ReturnTypeOf = T extends AnyFunction ? ReturnType : T extends AnyFunction[] ? UnionToIntersection, void>> : never; /** * @author https://stackoverflow.com/users/2887218/jcalz * @see https://stackoverflow.com/a/50375286/10325032 */ export type UnionToIntersection = (Union extends any ? (argument: Union) => void : never) extends (argument: infer Intersection) => void ? Intersection : never; type AnyFunction = (...args: any) => any; export type OctokitPlugin = (octokit: Octokit, options: OctokitOptions) => { [key: string]: any; } | void; export type Hooks = { request: { Options: Required; Result: OctokitTypes.OctokitResponse; Error: RequestError | Error; }; [key: string]: { Options: unknown; Result: unknown; Error: unknown; }; }; export {};