From 2ae811d804dc57c9b8681c279103c9e25e1e285e Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Sun, 3 Sep 2023 19:46:52 +0000 Subject: [PATCH] compile-solidity: type-assertion due to incompletely typed @types/semver For context, see discussion in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/61586 --- .../src/compilerSupplier/rangeUtils.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/compile-solidity/src/compilerSupplier/rangeUtils.ts b/packages/compile-solidity/src/compilerSupplier/rangeUtils.ts index 9bc410d6a70..6a8e5327991 100644 --- a/packages/compile-solidity/src/compilerSupplier/rangeUtils.ts +++ b/packages/compile-solidity/src/compilerSupplier/rangeUtils.ts @@ -36,15 +36,17 @@ export function rangeContainsAtLeast( semver.gte(range, comparisonVersion, { includePrerelease: true, loose: true - }) + } as semver.Options) ); //the following line doesn't, despite the flag, but does work with version ranges const rangeAtLeast = !!( - semver.validRange(range, { loose: true }) && - !semver.gtr(comparisonVersion, range, { - includePrerelease: true, - loose: true - }) //intersects will throw if given undefined so must ward against + ( + semver.validRange(range, { loose: true }) && + !semver.gtr(comparisonVersion, range, { + includePrerelease: true, + loose: true + }) + ) //intersects will throw if given undefined so must ward against ); return individualAtLeast || rangeAtLeast; }