I am using Inquirer & Typescript 2.3 for a console application, here's whats goind down
- I want to have the user pick a name from the lists using await. No problem
- Afterwards, i want the user to pick 1 or more options that he would like to adjust. No problem
- I want to loop trough all the chosen option, using the same async/await as before.
- I want to fill up the answersobject like{fieldName: chosenOption, fieldname2: chosenOption2}
But that's where i get into trouble. I have tried various options, but whatever kind of loop i use, I end up with getting all * qeuestions to answer and have them the same value.
I see this is a subject widely explained, but i am simply overlooking something obvious. In order not to take up space the this.ask class property is included as gist.
async startInteractive() {
    let names = Object.keys(this.config('connect'));
    let name  = await this.ask.list('name', names);
    console.log('need to edit ', name);
    let availableFields       = [ 'user', 'host', 'port', 'method', 'localPath', 'hostPath' ]
    let chosenFields: Answers = await this.ask.checkbox('Choose fields to edit', availableFields)
    let current               = this.config('connect.' + name);
    let answers = {}
    // THIS PART
    // is the issue i'm not able to tackle
    await chosenFields.map(async (field) => {
        answers[ field ] = await this.ask.ask(field)
    })
}
Edit: this is the visual representation of the problem:




 
    