diff --git a/src/index.ts b/src/index.ts index 6da07c51d2..831232e953 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { Collection, HookCollection } from "before-after-hook"; import { request } from "@octokit/request"; import { graphql, withCustomRequest } from "@octokit/graphql"; -import { OctokitOptions, Parameters, Plugin } from "./types"; +import { OctokitOptions, Plugin, RequestParameters } from "./types"; import { VERSION } from "./version"; import { withAuthorizationPrefix } from "./auth"; @@ -34,7 +34,7 @@ export class Octokit { constructor(options: OctokitOptions = {}) { const hook = new Collection(); - const requestDefaults: Required = { + const requestDefaults: Required = { baseUrl: request.endpoint.DEFAULTS.baseUrl, headers: {}, request: Object.assign({}, options.request, { diff --git a/src/types.ts b/src/types.ts index 16073369c0..443bc8b60a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,14 +1,12 @@ -import { - EndpointOptions, - RequestInterface, - RequestRequestOptions -} from "@octokit/types"; +import * as OctokitTypes from "@octokit/types"; import { Octokit } from "."; +export type RequestParameters = OctokitTypes.RequestParameters; + export type OctokitOptions = { auth?: string | AutenticationHook; - request?: RequestRequestOptions; + request?: Octokit.typesRequestRequestOptions; timeZone?: string; [option: string]: any; }; @@ -17,9 +15,9 @@ interface AutenticationHook { (options?: any): any; hook: ( - request: RequestInterface, - options: EndpointOptions - ) => ReturnType; + request: OctokitTypes.RequestInterface, + options: OctokitTypes.EndpointOptions + ) => ReturnType; } export type Plugin = (octokit: Octokit, options: OctokitOptions) => void;