From 2104633dd30f70d4b24966646e3d421850fd5ec8 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Saini <40729749+rockingrohit9639@users.noreply.github.com> Date: Sat, 9 Mar 2024 20:44:06 +0530 Subject: [PATCH] fix: update github id types from number to bigint in typescript (#160) --- pages/api/utils.ts | 6 +++--- utils/errors.ts | 2 +- utils/github.ts | 2 +- utils/webhook/linear.handler.ts | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pages/api/utils.ts b/pages/api/utils.ts index 57c2872..b481306 100644 --- a/pages/api/utils.ts +++ b/pages/api/utils.ts @@ -41,7 +41,7 @@ export default (_, res: NextApiResponse) => { */ export const upsertUser = async ( linearClient: LinearClient, - githubUserId: number, + githubUserId: bigint, linearUserId: string, userAgentHeader: string, githubAuthHeader: string @@ -217,7 +217,7 @@ export const applyLabel = async ({ userAgentHeader }: { repoFullName: string; - issueNumber: number; + issueNumber: bigint; labelNames: string[]; githubAuthHeader: string; userAgentHeader: string; @@ -252,7 +252,7 @@ export const createComment = async ({ userAgentHeader }: { repoFullName: string; - issueNumber: number; + issueNumber: bigint; body: string; githubAuthHeader: string; userAgentHeader: string; diff --git a/utils/errors.ts b/utils/errors.ts index 8e19524..64a9bc7 100644 --- a/utils/errors.ts +++ b/utils/errors.ts @@ -3,7 +3,7 @@ import { formatJSON } from "."; export const getIssueUpdateError = ( resource: "state" | "description" | "title" | "assignee", data: { number: number; id: string; team: { key: string } }, - syncedIssue: { githubIssueNumber: number; githubIssueId: number }, + syncedIssue: { githubIssueNumber: bigint; githubIssueId: bigint }, updatedIssueResponse: any ): string => { return `Failed to update GitHub issue ${resource} for ${data.team.key}-${ diff --git a/utils/github.ts b/utils/github.ts index 02d6595..c875a26 100644 --- a/utils/github.ts +++ b/utils/github.ts @@ -315,7 +315,7 @@ export const updateMilestone = async ( export const setIssueMilestone = async ( token: string, repoName: string, - issueNumber: number, + issueNumber: bigint, milestoneId: number | null ): Promise => { const response = await fetch( diff --git a/utils/webhook/linear.handler.ts b/utils/webhook/linear.handler.ts index 100708d..1d65f80 100644 --- a/utils/webhook/linear.handler.ts +++ b/utils/webhook/linear.handler.ts @@ -388,7 +388,7 @@ export async function linearWebhookHandler( const { error: applyLabelError } = await applyLabel({ repoFullName, - issueNumber: createdIssueData.number, + issueNumber: BigInt(createdIssueData.number), labelNames, githubAuthHeader, userAgentHeader @@ -432,7 +432,7 @@ export async function linearWebhookHandler( const { error: commentError } = await createComment({ repoFullName, - issueNumber: createdIssueData.number, + issueNumber: BigInt(createdIssueData.number), body: `${modifiedComment || ""}${footer}`, githubAuthHeader, userAgentHeader @@ -1119,7 +1119,7 @@ export async function linearWebhookHandler( const { error: applyLabelError } = await applyLabel({ repoFullName, - issueNumber: createdIssueData.number, + issueNumber: BigInt(createdIssueData.number), labelNames, githubAuthHeader, userAgentHeader