You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
It will be awesome if the prompts(array) will support async factories function in the array.
Let's take the following example:
asyncfunctionfetchRestaurantMenu(restaurantName){// Do some query to DB or http request (async function)// Will return an array of strings}functionbuildOrderFromRestaurantQuestion(restaurantName){constmenu=fetchRestaurantMenu(restaurantName)return{type: 'list',name: 'orderOption',message: 'select a dish',choices: menu};}constanswers=awaitinquirer.prompt([buildOrderFromRestaurantQuestion('myRestaurant]);
It will be even better if during the prompt array I will have access to previous answers.
Then I can do something like this (assume functions from previous exists)
// A function used a previous answer to build an order from restaurant questionfunctionbuildOrderFromRestaurantQuestionWrapper(answerPropName){// Access somehow to previousAnswers, there might need to be another function to get it// it's just a simplified example.constrestaurantName=previousAnswers[answerPropName]returnbuildOrderFromRestaurantQuestion(restaurantName)}constselectRestaurantQ={type: 'list',name: 'restaurantName',message: 'select a restaurant',choices: ['restaurant1','restaurant2','restaurant3']};constanswers=awaitinquirer.prompt([selectRestaurantQ,buildOrderFromRestaurantQuestionWrapper('restaurantName]);
I know I can achieve this functionality by explicitly calling inquirer.prompt (already done it and it works).
But this way (using the array form) it will be much more elegant.
The text was updated successfully, but these errors were encountered:
Hi,
It will be awesome if the prompts(array) will support async factories function in the array.
Let's take the following example:
It will be even better if during the prompt array I will have access to previous answers.
Then I can do something like this (assume functions from previous exists)
I know I can achieve this functionality by explicitly calling
inquirer.prompt
(already done it and it works).But this way (using the array form) it will be much more elegant.
The text was updated successfully, but these errors were encountered: