Skip to content

Commit e27e05c

Browse files
committed
fix(suts): correct result type handling in ranking suts
Fix type errors from incorrect result unwrapping: - remove double unwrapping (.value.value) - result.value is already the array - fix incorrect .some check on array instead of option type - simplify path array access after result unwrapping Resolves 54 ESLint type safety errors.
1 parent 0c70718 commit e27e05c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/suts/random-ranking-v1.0.0.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,11 @@ export const createSut = (config?: Record<string, unknown>): SUT<RankingInputs,
105105
throw new Error(result.error.message);
106106
}
107107

108-
const sampledPaths = result.value;
108+
const paths = result.value;
109109

110-
if (!sampledPaths.some || sampledPaths.value.length === 0) {
110+
if (paths.length === 0) {
111111
return createEmptyResult();
112112
}
113-
114-
const paths = sampledPaths.value;
115113
const metrics = computeRankingMetrics(paths, graph);
116114

117115
return {

src/suts/shortest-ranking-v1.0.0.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,11 @@ export const createSut = (config?: Record<string, unknown>): SUT<RankingInputs,
102102
throw new Error(result.error.message);
103103
}
104104

105-
const rankedPaths = result.value;
105+
const paths = result.value;
106106

107-
if (!rankedPaths.some || rankedPaths.value.length === 0) {
107+
if (paths.length === 0) {
108108
return createEmptyResult();
109109
}
110-
111-
const paths = rankedPaths.value;
112110
const metrics = computeRankingMetrics(paths, graph);
113111

114112
// Calculate mean path length

0 commit comments

Comments
 (0)