Skip to content

Commit

Permalink
refactor: adapt code for the exactOptionalPropertyTypes (#577)
Browse files Browse the repository at this point in the history
* refactor: adapt code for the `exactOptionalPropertyTypes`

* test: enable `exactOptionalPropertyTypes` in `test:typescript`
  • Loading branch information
wolfy1339 authored Sep 24, 2024
1 parent c08cab4 commit 58d17f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint:fix": "prettier --write {src,test}/* *.md package.json",
"pretest": "npm run -s lint",
"test": "vitest run --coverage",
"test:typescript": "npx tsc --allowImportingTsExtensions --noEmit --declaration --noUnusedLocals --esModuleInterop --strict --target es2022 --moduleResolution node16 --module node16 test/typescript-validate.ts"
"test:typescript": "npx tsc --allowImportingTsExtensions --noEmit --declaration --noUnusedLocals --esModuleInterop --strict --target es2022 --moduleResolution node16 --module node16 --exactOptionalPropertyTypes test/typescript-validate.ts"
},
"repository": "github:octokit/app.js",
"author": "Gregor Martynus (https://github.com/gr2m)",
Expand Down
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Octokit as OctokitCore } from "@octokit/core";
import { Octokit as OctokitCore, type OctokitOptions } from "@octokit/core";
import { createAppAuth } from "@octokit/auth-app";
import { OAuthApp } from "@octokit/oauth-app";
import type { Webhooks } from "@octokit/webhooks";
Expand Down Expand Up @@ -99,11 +99,16 @@ export class App<TOptions extends Options = Options> {
: {},
);

this.octokit = new Octokit({
const octokitOptions: OctokitOptions = {
authStrategy: createAppAuth,
auth: authOptions,
log: options.log,
}) as OctokitType<TOptions>;
};

if ("log" in options && typeof options.log !== "undefined") {
octokitOptions.log = options.log;
}

this.octokit = new Octokit(octokitOptions) as OctokitType<TOptions>;

this.log = Object.assign(
{
Expand Down

0 comments on commit 58d17f9

Please sign in to comment.