From 69677e206f43f7d4ff397e9cf09582dff0c1e1c7 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 17 Apr 2020 15:54:50 -0700 Subject: [PATCH] Fix Semver parsing error --- packages/perf/src/measure/measurePerf.ts | 3 ++- packages/utils/src/semver.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/perf/src/measure/measurePerf.ts b/packages/perf/src/measure/measurePerf.ts index 8ee58a631f..a663e87510 100644 --- a/packages/perf/src/measure/measurePerf.ts +++ b/packages/perf/src/measure/measurePerf.ts @@ -257,7 +257,8 @@ function getLatestTypesVersionForTypeScriptVersion( ): string | undefined { const tsVersion = Semver.parse(typeScriptVersion.replace(/-dev.*$/, "")); for (let i = typesVersions.length - 1; i > 0; i--) { - const typesVersion = Semver.parse(typesVersions[i]); + const [major, minor] = typesVersions[i].split(".").map(Number); // e.g. '3.5' + const typesVersion = new Semver(major, minor, 0); if (tsVersion.greaterThan(typesVersion)) { return typesVersions[i]; } diff --git a/packages/utils/src/semver.ts b/packages/utils/src/semver.ts index f54d45c559..854c626288 100644 --- a/packages/utils/src/semver.ts +++ b/packages/utils/src/semver.ts @@ -8,7 +8,7 @@ export class Semver { return result; } - static fromRaw({ major, minor, patch }: Semver): Semver { + static fromRaw({ major, minor, patch }: { major: number; minor: number; patch: number }): Semver { return new Semver(major, minor, patch); }