Skip to content

Commit 69a1d8b

Browse files
chore(deps): update dependency @octokit/tsconfig to v4 (#735)
1 parent 72a7a09 commit 69a1d8b

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"update-endpoints": "npm-run-all update-endpoints:*",
1717
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.js",
1818
"update-endpoints:code": "node scripts/update-endpoints/code.js",
19-
"validate:ts": "tsc --noEmit --noImplicitAny --target es2022 --esModuleInterop --moduleResolution node16 --module node16 test/typescript-validate.ts"
19+
"validate:ts": "tsc --noEmit --noImplicitAny --target es2022 --strict --esModuleInterop --moduleResolution node16 --module node16 --exactOptionalPropertyTypes test/typescript-validate.ts"
2020
},
2121
"repository": "github:octokit/plugin-throttling.js",
2222
"author": "Simon Grondin (http://github.com/SGrondin)",
@@ -31,7 +31,7 @@
3131
"devDependencies": {
3232
"@octokit/core": "^6.0.0",
3333
"@octokit/request-error": "^6.0.1",
34-
"@octokit/tsconfig": "^3.0.0",
34+
"@octokit/tsconfig": "^4.0.0",
3535
"@types/node": "^20.0.0",
3636
"@vitest/coverage-v8": "^2.0.2",
3737
"esbuild": "^0.24.0",

src/index.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
import BottleneckLight from "bottleneck/light.js";
33
import type TBottleneck from "bottleneck";
44
import type { Octokit, OctokitOptions } from "@octokit/core";
5-
import type { Groups, State, ThrottlingOptions } from "./types.js";
5+
import type {
6+
CreateGroupsCommon,
7+
Groups,
8+
State,
9+
ThrottlingOptions,
10+
} from "./types.js";
611
import { VERSION } from "./version.js";
712

813
import { wrapRequest } from "./wrap-request.js";
@@ -18,13 +23,7 @@ const groups: Groups = {};
1823

1924
const createGroups = function (
2025
Bottleneck: typeof TBottleneck,
21-
common: {
22-
connection:
23-
| TBottleneck.RedisConnection
24-
| TBottleneck.IORedisConnection
25-
| undefined;
26-
timeout: number;
27-
},
26+
common: CreateGroupsCommon,
2827
) {
2928
groups.global = new Bottleneck.Group({
3029
id: "octokit-global",
@@ -62,7 +61,10 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) {
6261
if (!enabled) {
6362
return {};
6463
}
65-
const common = { connection, timeout };
64+
const common: CreateGroupsCommon = { timeout };
65+
if (typeof connection !== "undefined") {
66+
common.connection = connection;
67+
}
6668

6769
if (groups.global == null) {
6870
createGroups(Bottleneck, common);

src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ export type State = {
5353
id: string;
5454
} & Required<Groups> &
5555
ThrottlingOptions;
56+
57+
export type CreateGroupsCommon = {
58+
connection?: Bottleneck.RedisConnection | Bottleneck.IORedisConnection;
59+
timeout: number;
60+
};

0 commit comments

Comments
 (0)