Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 07a96eb

Browse files
committed
Adding type annotation
1 parent 10a0fe6 commit 07a96eb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cli/script/command-executor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ function getReactNativeProjectAppVersion(command: cli.IReleaseReactCommand, proj
864864
catch (e) { return false }
865865
};
866866

867-
const validVersion = (version: string) => semver.valid(version) || /^\d+\.\d+$/.test(version);
867+
const isValidVersion = (version: string): boolean => !!semver.valid(version) || /^\d+\.\d+$/.test(version);
868868

869869
if (command.platform === "ios") {
870870
let resolvedPlistFile: string = command.plistFile;
@@ -899,7 +899,7 @@ function getReactNativeProjectAppVersion(command: cli.IReleaseReactCommand, proj
899899
}
900900

901901
if (parsedPlist && parsedPlist.CFBundleShortVersionString) {
902-
if (validVersion(parsedPlist.CFBundleShortVersionString)) {
902+
if (isValidVersion(parsedPlist.CFBundleShortVersionString)) {
903903
return Q(parsedPlist.CFBundleShortVersionString);
904904
} else {
905905
throw new Error(`The "CFBundleShortVersionString" key in the "${resolvedPlistFile}" needs to have at least a major and minor version, for example "2.0" or "1.0.3".`);
@@ -928,7 +928,7 @@ function getReactNativeProjectAppVersion(command: cli.IReleaseReactCommand, proj
928928

929929
let appVersion: string = buildGradle.android.defaultConfig.versionName.replace(/"/g, "").trim();
930930

931-
if (validVersion(appVersion)) {
931+
if (isValidVersion(appVersion)) {
932932
// The versionName property is a valid semver string,
933933
// so we can safely use that and move on.
934934
return appVersion;
@@ -963,7 +963,7 @@ function getReactNativeProjectAppVersion(command: cli.IReleaseReactCommand, proj
963963
throw new Error(`No property named "${propertyName}" exists in the "${propertiesFile}" file.`);
964964
}
965965

966-
if (!validVersion(appVersion)) {
966+
if (!isValidVersion(appVersion)) {
967967
throw new Error(`The "${propertyName}" property in "${propertiesFile}" needs to specify a valid semver string, containing both a major and minor version (e.g. 1.3.2, 1.1).`);
968968
}
969969

0 commit comments

Comments
 (0)