From 16962a989f8f9627da6d600830f2535af3f4505b Mon Sep 17 00:00:00 2001
From: Jamie Magee <JamieMagee@users.noreply.github.com>
Date: Tue, 3 Mar 2020 23:08:45 +0100
Subject: [PATCH] chore: better types for azure (#5633)

---
 lib/platform/azure/index.ts                   | 21 ++++++++-----------
 .../azure/__snapshots__/index.spec.ts.snap    |  1 -
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts
index 9cbc7d690b..b9facb5f28 100644
--- a/lib/platform/azure/index.ts
+++ b/lib/platform/azure/index.ts
@@ -43,7 +43,7 @@ interface Config {
   owner: string;
   repoId: string;
   project: string;
-  azureWorkItemId: any;
+  azureWorkItemId: string;
   prList: Pr[];
   fileList: null;
   repository: string;
@@ -297,9 +297,7 @@ export async function findPr({
   prTitle,
   state = 'all',
 }: FindPRConfig): Promise<Pr | null> {
-  logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`);
-  // TODO: fix typing
-  let prsFiltered: any[] = [];
+  let prsFiltered: Pr[] = [];
   try {
     const prs = await getPrList();
 
@@ -404,7 +402,7 @@ export async function getBranchStatusCheck(
 
 export async function getBranchStatus(
   branchName: string,
-  requiredStatusChecks: any
+  requiredStatusChecks: string[]
 ): Promise<BranchStatus> {
   logger.debug(`getBranchStatus(${branchName})`);
   if (!requiredStatusChecks) {
@@ -439,7 +437,7 @@ export async function createPr({
       id: config.azureWorkItemId,
     },
   ];
-  let pr: any = await azureApiGit.createPullRequest(
+  let pr: GitPullRequest = await azureApiGit.createPullRequest(
     {
       sourceRefName,
       targetRefName,
@@ -453,7 +451,7 @@ export async function createPr({
     pr = await azureApiGit.updatePullRequest(
       {
         autoCompleteSetBy: {
-          id: pr.createdBy!.id,
+          id: pr.createdBy.id,
         },
         completionOptions: {
           mergeStrategy: config.mergeMethod,
@@ -461,7 +459,7 @@ export async function createPr({
         },
       },
       config.repoId,
-      pr.pullRequestId!
+      pr.pullRequestId
     );
   }
   await Promise.all(
@@ -471,11 +469,10 @@ export async function createPr({
           name: label,
         },
         config.repoId,
-        pr.pullRequestId!
+        pr.pullRequestId
       )
     )
   );
-  pr.branchName = branchName;
   return azureHelper.getRenovatePRFormat(pr);
 }
 
@@ -486,7 +483,7 @@ export async function updatePr(
 ): Promise<void> {
   logger.debug(`updatePr(${prNo}, ${title}, body)`);
   const azureApiGit = await azureApi.gitApi();
-  const objToUpdate: any = {
+  const objToUpdate: GitPullRequest = {
     title,
   };
   if (body) {
@@ -682,7 +679,7 @@ export async function addReviewers(
     )
   );
 
-  const ids: any[] = [];
+  const ids: { id: string; name: string }[] = [];
   members.forEach(listMembers => {
     listMembers.forEach(m => {
       reviewers.forEach(r => {
diff --git a/test/platform/azure/__snapshots__/index.spec.ts.snap b/test/platform/azure/__snapshots__/index.spec.ts.snap
index c7d29e87fa..d3ce8c6ad5 100644
--- a/test/platform/azure/__snapshots__/index.spec.ts.snap
+++ b/test/platform/azure/__snapshots__/index.spec.ts.snap
@@ -21,7 +21,6 @@ Object {
   "autoCompleteSetBy": Object {
     "id": 123,
   },
-  "branchName": "some-branch",
   "completionOptions": Object {
     "deleteSourceBranch": true,
     "squashMerge": true,
-- 
GitLab