Skip to content

Commit

Permalink
Explicitly declare return types (#1589)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Ling <[email protected]>
  • Loading branch information
samchungy and 72636c committed Jun 20, 2024
1 parent e482715 commit 9bb3dd7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-houses-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'skuba': patch
---

Git: Explicitly declare return types to enable compatibility with the `Node16` module
2 changes: 1 addition & 1 deletion src/api/git/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const fastForwardBranch = async ({
ref,
remote,
remoteRef,
}: PullParameters) => {
}: PullParameters): Promise<void> => {
const { owner, repo } = await getOwnerAndRepo({ dir });

const url = `https://github.com/${encodeURIComponent(
Expand Down
15 changes: 14 additions & 1 deletion src/api/git/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ interface PushParameters {
force?: boolean;
}

interface PushResult {
ok: boolean;
error: string | null;
refs: Record<
string,
{
ok: boolean;
error: string;
}
>;
headers?: Record<string, string> | undefined;
}

/**
* Pushes the specified `ref` from the local Git repository to a remote.
*/
Expand All @@ -61,7 +74,7 @@ export const push = async ({
remote,
remoteRef,
force,
}: PushParameters) => {
}: PushParameters): Promise<PushResult> => {
const { owner, repo } = await getOwnerAndRepo({ dir });

const url = `https://github.com/${encodeURIComponent(
Expand Down
15 changes: 10 additions & 5 deletions src/api/github/push.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import path from 'path';

import type {
CreateCommitOnBranchInput,
FileAddition,
FileDeletion,
} from '@octokit/graphql-schema';
import type { CreateCommitOnBranchInput } from '@octokit/graphql-schema';
import fs from 'fs-extra';

import * as Git from '../git';
Expand Down Expand Up @@ -101,6 +97,15 @@ export const uploadAllFileChanges = async ({
return commitId;
};

interface FileAddition {
contents: unknown;
path: string;
}

interface FileDeletion {
path: string;
}

export interface FileChanges {
additions: FileAddition[];
deletions: FileDeletion[];
Expand Down

0 comments on commit 9bb3dd7

Please sign in to comment.