From 45d0dbf884b692e62c8b7fd426776d6fd3af585a Mon Sep 17 00:00:00 2001
From: IKEDA Sho <suicaicoca@gmail.com>
Date: Sun, 24 Jul 2022 14:53:54 +0900
Subject: [PATCH] refactor(workers): Prefer interface over type (#16727)

https://github.com/renovatebot/renovate/blob/main/docs/development/best-practices.md#general
---
 lib/workers/repository/init/types.ts                      | 4 ++--
 lib/workers/repository/process/extract-update.ts          | 4 ++--
 .../update/branch/execute-post-upgrade-commands.ts        | 4 ++--
 lib/workers/repository/update/branch/status-checks.ts     | 8 ++++----
 lib/workers/repository/update/pr/automerge.ts             | 4 ++--
 lib/workers/repository/update/pr/index.ts                 | 8 ++++----
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lib/workers/repository/init/types.ts b/lib/workers/repository/init/types.ts
index cd1cbab024..96590b420a 100644
--- a/lib/workers/repository/init/types.ts
+++ b/lib/workers/repository/init/types.ts
@@ -1,7 +1,7 @@
-export type RepoConfigError = {
+export interface RepoConfigError {
   validationError: string;
   validationMessage: string;
-};
+}
 
 export interface RepoFileConfig {
   configFileName?: string;
diff --git a/lib/workers/repository/process/extract-update.ts b/lib/workers/repository/process/extract-update.ts
index e0777d8c8a..eec43b5e44 100644
--- a/lib/workers/repository/process/extract-update.ts
+++ b/lib/workers/repository/process/extract-update.ts
@@ -14,11 +14,11 @@ import { fetchUpdates } from './fetch';
 import { sortBranches } from './sort';
 import { WriteUpdateResult, writeUpdates } from './write';
 
-export type ExtractResult = {
+export interface ExtractResult {
   branches: BranchConfig[];
   branchList: string[];
   packageFiles: Record<string, PackageFile[]>;
-};
+}
 
 export interface StatsResult {
   fileCount: number;
diff --git a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts
index fb2c6bcda0..4163f4412e 100644
--- a/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts
+++ b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts
@@ -18,10 +18,10 @@ import { sanitize } from '../../../../util/sanitize';
 import { compile } from '../../../../util/template';
 import type { BranchConfig, BranchUpgradeConfig } from '../../../types';
 
-export type PostUpgradeCommandsExecutionResult = {
+export interface PostUpgradeCommandsExecutionResult {
   updatedArtifacts: FileChange[];
   artifactErrors: ArtifactError[];
-};
+}
 
 export async function postUpgradeCommandsExecutor(
   filteredUpgradeCommands: BranchUpgradeConfig[],
diff --git a/lib/workers/repository/update/branch/status-checks.ts b/lib/workers/repository/update/branch/status-checks.ts
index 023cd083ee..93aa936618 100644
--- a/lib/workers/repository/update/branch/status-checks.ts
+++ b/lib/workers/repository/update/branch/status-checks.ts
@@ -51,10 +51,10 @@ async function setStatusCheck(
   }
 }
 
-export type StabilityConfig = RenovateConfig & {
+export interface StabilityConfig extends RenovateConfig {
   stabilityStatus?: BranchStatus;
   branchName: string;
-};
+}
 
 export async function setStability(config: StabilityConfig): Promise<void> {
   if (!config.stabilityStatus) {
@@ -74,10 +74,10 @@ export async function setStability(config: StabilityConfig): Promise<void> {
   );
 }
 
-export type ConfidenceConfig = RenovateConfig & {
+export interface ConfidenceConfig extends RenovateConfig {
   confidenceStatus?: BranchStatus;
   minimumConfidence?: MergeConfidence;
-};
+}
 
 export async function setConfidence(config: ConfidenceConfig): Promise<void> {
   if (
diff --git a/lib/workers/repository/update/pr/automerge.ts b/lib/workers/repository/update/pr/automerge.ts
index fd875b9bb5..20ba1bc1ef 100644
--- a/lib/workers/repository/update/pr/automerge.ts
+++ b/lib/workers/repository/update/pr/automerge.ts
@@ -27,11 +27,11 @@ export enum PrAutomergeBlockReason {
   OffSchedule = 'off schedule',
 }
 
-export type AutomergePrResult = {
+export interface AutomergePrResult {
   automerged: boolean;
   branchRemoved?: boolean;
   prAutomergeBlockReason?: PrAutomergeBlockReason;
-};
+}
 
 export async function checkAutoMerge(
   pr: Pr,
diff --git a/lib/workers/repository/update/pr/index.ts b/lib/workers/repository/update/pr/index.ts
index d29209423c..dfc79500d4 100644
--- a/lib/workers/repository/update/pr/index.ts
+++ b/lib/workers/repository/update/pr/index.ts
@@ -51,15 +51,15 @@ export function getPlatformPrOptions(
   };
 }
 
-export type ResultWithPr = {
+export interface ResultWithPr {
   type: 'with-pr';
   pr: Pr;
-};
+}
 
-export type ResultWithoutPr = {
+export interface ResultWithoutPr {
   type: 'without-pr';
   prBlockedBy: PrBlockedBy;
-};
+}
 
 export type EnsurePrResult = ResultWithPr | ResultWithoutPr;
 
-- 
GitLab