diff --git a/lib/versioning/ubuntu/index.ts b/lib/versioning/ubuntu/index.ts index d875e52aedd58640c9c00babdbb5add64f4afcbd..07e470eedffd8fbcaa987144dc19a8be420cd5b1 100644 --- a/lib/versioning/ubuntu/index.ts +++ b/lib/versioning/ubuntu/index.ts @@ -72,12 +72,12 @@ function getPatch(version: string): null | number { // comparison function equals(version: string, other: string): boolean { - return isVersion(version) && isVersion(other) && version === other; + return !!isVersion(version) && !!isVersion(other) && version === other; } function isGreaterThan(version: string, other: string): boolean { - const xMajor = getMajor(version); - const yMajor = getMajor(other); + const xMajor = getMajor(version) ?? 0; + const yMajor = getMajor(other) ?? 0; if (xMajor > yMajor) { return true; } @@ -85,8 +85,8 @@ function isGreaterThan(version: string, other: string): boolean { return false; } - const xMinor = getMinor(version); - const yMinor = getMinor(other); + const xMinor = getMinor(version) ?? 0; + const yMinor = getMinor(other) ?? 0; if (xMinor > yMinor) { return true; } @@ -94,8 +94,8 @@ function isGreaterThan(version: string, other: string): boolean { return false; } - const xPatch = getPatch(version) || 0; - const yPatch = getPatch(other) || 0; + const xPatch = getPatch(version) ?? 0; + const yPatch = getPatch(other) ?? 0; return xPatch > yPatch; } diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 61ba5f4a3991cc230dc8d56e97764a082fd25041..7a93df971d22c86dd756015a75ca7dd04c4c653b 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -134,6 +134,8 @@ "./lib/util/sanitize.ts", "./lib/util/split.ts", "./lib/util/url.ts", + "./lib/versioning/ubuntu/index.spec.ts", + "./lib/versioning/ubuntu/index.ts", "./lib/workers/pr/changelog/hbs-template.ts", "./lib/workers/pr/changelog/types.ts", "./lib/workers/repository/init/types.ts",