Skip to content

Commit 99e4cce

Browse files
Copilotmrjf
andauthored
Remove unnecessary type assertion in bench_series_shift.ts
Agent-Logs-Url: https://github.com/githubnext/tsessebe/sessions/1e7df0b6-e9eb-49c2-8eae-d7d34974af6f Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent 646262b commit 99e4cce

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

benchmarks/tsb/bench_series_shift.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ const s = new Series({ data });
1515

1616
/** Shift a numeric Series by 1 position, filling with null. */
1717
function shiftSeries(series: Series<number>): Series<number | null> {
18-
const vals = series.values as readonly number[];
18+
const vals = series.toArray();
1919
const shifted: (number | null)[] = [null];
2020
for (let i = 0; i < vals.length - 1; i++) {
21-
shifted.push(vals[i] as number);
21+
const v = vals[i];
22+
if (v !== undefined) shifted.push(v);
2223
}
2324
return new Series({ data: shifted });
2425
}

0 commit comments

Comments
 (0)