Skip to content

Commit

Permalink
fix(typescript): const octokit = new Octokit();
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Aug 13, 2021
1 parent b734489 commit 51ee163
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,20 @@ export declare class Octokit<
* You can optionally set the `auth` option to an access token string in order
* to authenticate requests.
*/
constructor(options: { version?: TVersion } & { auth?: string } & TOptions);
constructor(
...options: NonOptionalKeys<TOptions> extends undefined
? [({ version?: TVersion } & { auth?: string } & TOptions)?]
: [{ version?: TVersion } & { auth?: string } & TOptions]
);

/**
* Constructor with setting `authStrategy`
*
* The `auth` option must be set to whatever the function passed as `authStrategy` accepts
*/
constructor(
// we assume that if `authStrategy` is set, the `auth` option is always required,
// hence the constructor options are always required
options: { version?: TVersion } & AuthStrategyAndOptions<TAuthStrategy> &
TOptions
);
Expand Down

0 comments on commit 51ee163

Please sign in to comment.