Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Semver parsing error #4

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/perf/src/measure/measurePerf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/semver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down