diff --git a/lib/modules/manager/npm/update/package-version/index.ts b/lib/modules/manager/npm/update/package-version/index.ts index ba5022fb0ac0d7e3c306990fc488c5d5153ef316..63581011f176aa2206558915a2da3c0f4fe4da0b 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 =