Skip to content

Commit

Permalink
repl: reset events when start and add types to inquirer prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyz0112 committed Jan 13, 2019
1 parent 218dace commit e3de1f7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -56,7 +57,9 @@ function getCode(): string {
saveEvents();
}

const { shouldRecordAnother } = await inquirer.prompt([
const { shouldRecordAnother } = await inquirer.prompt<{
shouldRecordAnother: boolean;
}>([
{
type: 'confirm',
name: 'shouldRecordAnother',
Expand Down

0 comments on commit e3de1f7

Please sign in to comment.