From e3de1f75b9b5a10034f7380a8a4b45c5a9d5b04d Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Sun, 13 Jan 2019 10:56:59 +0800 Subject: [PATCH] repl: reset events when start and add types to inquirer prompt --- scripts/repl.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/repl.ts b/scripts/repl.ts index 101945ad..72edc453 100644 --- a/scripts/repl.ts +++ b/scripts/repl.ts @@ -21,7 +21,8 @@ function getCode(): string { start(); async function start() { - const { url } = await inquirer.prompt([ + events = []; + const { url } = await inquirer.prompt<{ url: string }>([ { type: 'input', name: 'url', @@ -34,7 +35,7 @@ function getCode(): string { await record(url); console.log('Ready to record. You can do any interaction on the page.'); - const { shouldReplay } = await inquirer.prompt([ + const { shouldReplay } = await inquirer.prompt<{ shouldReplay: boolean }>([ { type: 'confirm', name: 'shouldReplay', @@ -44,7 +45,7 @@ function getCode(): string { emitter.emit('done', shouldReplay); - const { shouldStore } = await inquirer.prompt([ + const { shouldStore } = await inquirer.prompt<{ shouldStore: boolean }>([ { type: 'confirm', name: 'shouldStore', @@ -56,7 +57,9 @@ function getCode(): string { saveEvents(); } - const { shouldRecordAnother } = await inquirer.prompt([ + const { shouldRecordAnother } = await inquirer.prompt<{ + shouldRecordAnother: boolean; + }>([ { type: 'confirm', name: 'shouldRecordAnother',