Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: adapt code for the exactOptionalPropertyTypes #577

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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