Skip to content

Commit 2554a8f

Browse files
committed
fix(cli): replace non-null assertion with optional chaining in spinner
Use optional chaining with fallback instead of non-null assertion (!) for array access. While mathematically safe, this pattern is more defensive and avoids potential runtime errors.
1 parent 413a890 commit 2554a8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cli/bin/postgres-ai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function createTtySpinner(
142142
const render = (): void => {
143143
if (stopped) return;
144144
const elapsedSec = ((Date.now() - startTs) / 1000).toFixed(1);
145-
const frame = frames[frameIdx % frames.length]!;
145+
const frame = frames[frameIdx % frames.length] ?? frames[0] ?? "⠿";
146146
frameIdx += 1;
147147
process.stdout.write(`\r\x1b[2K${frame} ${text} (${elapsedSec}s)`);
148148
};

0 commit comments

Comments
 (0)