From 0f872f8b1aa240c78f3c1ce1717bd41da17b9cd5 Mon Sep 17 00:00:00 2001
From: Sergei Zharinov <zharinov@users.noreply.github.com>
Date: Fri, 4 Aug 2023 22:27:42 +0300
Subject: [PATCH] fix(npm): Types for `bumpVersion` parameter (#23717)

---
 .../manager/npm/update/package-version/index.ts      | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/modules/manager/npm/update/package-version/index.ts b/lib/modules/manager/npm/update/package-version/index.ts
index ba5022fb0a..63581011f1 100644
--- a/lib/modules/manager/npm/update/package-version/index.ts
+++ b/lib/modules/manager/npm/update/package-version/index.ts
@@ -3,10 +3,18 @@ import { logger } from '../../../../../logger';
 import { regEx } from '../../../../../util/regex';
 import type { BumpPackageVersionResult } from '../../../types';
 
+type MirrorBumpVersion = `mirror:${string}`;
+
+function isMirrorBumpVersion(
+  bumpVersion: string
+): bumpVersion is MirrorBumpVersion {
+  return bumpVersion.startsWith('mirror:');
+}
+
 export function bumpPackageVersion(
   content: string,
   currentValue: string,
-  bumpVersion: ReleaseType
+  bumpVersion: ReleaseType | `mirror:${string}`
 ): BumpPackageVersionResult {
   logger.debug(
     { bumpVersion, currentValue },
@@ -16,7 +24,7 @@ export function bumpPackageVersion(
   let newPjVersion: string | null;
   let bumpedContent = content;
   try {
-    if (bumpVersion.startsWith('mirror:')) {
+    if (isMirrorBumpVersion(bumpVersion)) {
       const mirrorPackage = bumpVersion.replace('mirror:', '');
       const parsedContent = JSON.parse(content);
       newPjVersion =
-- 
GitLab