diff --git a/src/utils/history.ts b/src/utils/history.ts index a8f2420..0de2298 100644 --- a/src/utils/history.ts +++ b/src/utils/history.ts @@ -1,4 +1,4 @@ -type History = Record; +type History = Record; const history: History = {}; let historyIndex = 0; @@ -28,14 +28,15 @@ export function getCommandIfHistoryExpansion(input): string { if (index === '!') { command = getLast(); } else { - command = get(index); + // parseInt here is guaranteed to succeed I suppose. + command = get(parseInt(index)); } } return command; } -function get(index: string): string { +function get(index: number): string { return history[index]; }