Skip to content

Commit

Permalink
Fix REPL ASI handling when new input starts with '-' (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode authored Feb 15, 2020
1 parent 4d3305f commit 5b5ae91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ function appendEval (state: EvalState, input: string) {
const undoLines = state.lines

// Handle ASI issues with TypeScript re-evaluation.
if (undoInput.charAt(undoInput.length - 1) === '\n' && /^\s*[\/\[(`]/.test(input) && !/;\s*$/.test(undoInput)) {
if (undoInput.charAt(undoInput.length - 1) === '\n' && /^\s*[\/\[(`-]/.test(input) && !/;\s*$/.test(undoInput)) {
state.input = `${state.input.slice(0, -1)};\n`
}

Expand Down

0 comments on commit 5b5ae91

Please sign in to comment.