From 38a7762d934eed6d9d7d3a7af513d589ed0275c4 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Wed, 6 Jun 2018 12:40:43 +0530 Subject: [PATCH] Change paginate to accept async functions only Changed paginate param func signature from Response to Promise to accept only async functions --- src/gh.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gh.ts b/src/gh.ts index 39e1e34..82c4305 100644 --- a/src/gh.ts +++ b/src/gh.ts @@ -120,7 +120,7 @@ interface ObjectWithPerPage { } async function paginate( - method: (args: TFirstParam) => ResponseWithPaginationAndMeta, + method: (args: TFirstParam) => Promise>, args: TFirstParam ): Promise> { @@ -151,8 +151,8 @@ async function fetchRepoNameWithBranches( const branchesResponse: ResponseWithDataArray = await paginate( - (tmpFirstParam: rest.ReposGetBranchesParams): ResponseFromGetBranches => { - return octokit.repos.getBranches(tmpFirstParam) as any as ResponseFromGetBranches; + (tmpFirstParam: rest.ReposGetBranchesParams): Promise => { + return octokit.repos.getBranches(tmpFirstParam) as any as Promise; }, params ); @@ -289,8 +289,8 @@ async function fetchUnusedForkedRepos() { const repos: ResponseWithDataArray = await paginate( - (tmpFirstParam: rest.ReposGetForUserParams): ResponseFromGetUserRepo => { - return octokit.repos.getForUser(tmpFirstParam) as any as ResponseFromGetUserRepo; + (tmpFirstParam: rest.ReposGetForUserParams): Promise => { + return octokit.repos.getForUser(tmpFirstParam) as any as Promise; }, params );