Skip to content

Commit 777058b

Browse files
committed
just use structural typing
1 parent 1a9de9e commit 777058b

3 files changed

Lines changed: 31 additions & 84 deletions

File tree

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@
5757
"version-packages": "pnpm changeset version && pnpm format:fix"
5858
},
5959
"dependencies": {
60-
"@octokit/core": "^7.0.6",
61-
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
6260
"isomorphic-git": "^1.36.3"
6361
},
6462
"devDependencies": {
6563
"@actions/github": "^9.0.0",
6664
"@changesets/changelog-github": "^0.5.1",
6765
"@changesets/cli": "^2.27.7",
6866
"@graphql-codegen/cli": "^7.0.0",
69-
"@octokit/graphql": "^8.1.1",
7067
"@tsconfig/node22": "^22.0.5",
7168
"@types/node": "^20.11.24",
7269
"dotenv": "^16.4.5",

pnpm-lock.yaml

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

src/github/graphql/queries.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
import type { Octokit } from "@octokit/core"
2-
import type { Api } from "@octokit/plugin-rest-endpoint-methods"
3-
4-
export type GitHubClient = Octokit & Api
1+
// Octokit types are messy. To avoid adding any (peer)dependencies we rely on TS structural typing here
2+
export type GitHubClient = {
3+
graphql: <T>(query: string, variables?: Record<string, unknown>) => Promise<T>;
4+
rest: {
5+
git: {
6+
createRef: (params: {
7+
owner: string;
8+
repo: string;
9+
ref: string;
10+
sha: string;
11+
}) => Promise<{ data: { node_id?: string } }>;
12+
updateRef: (params: {
13+
owner: string;
14+
repo: string;
15+
ref: string;
16+
sha: string;
17+
force?: boolean;
18+
}) => Promise<{ data: { node_id?: string } }>;
19+
deleteRef: (params: {
20+
owner: string;
21+
repo: string;
22+
ref: string;
23+
}) => Promise<unknown>;
24+
getRef?: (params: {
25+
owner: string;
26+
repo: string;
27+
ref: string;
28+
}) => Promise<unknown>;
29+
};
30+
};
31+
};
532

633
import type {
734
CreateCommitOnBranchMutation,

0 commit comments

Comments
 (0)