0

I installed Inquirer package for a command prompt tool and wrote this simple prompt:

function promptUser(): void {
    console.clear();
    displayTodoList(); // harmless method. 

    inquirer.prompt({
        type: "list",
        name: "command",
        message: "Choose option",
        choices: Object.values(Commands)
    }).then(answers => {
        if (answers["command"] !== Commands.Quit) {
            promptUser(); // some other harmless method.
        }
    })
}

But Typescript gives me compile error that values does not exist on type 'ObjectConstructor' which is this line:

choices: Object.values(Commands)
  • 2
    Does this answer your question? [Property 'values' does not exist on type 'ObjectConstructor'](https://stackoverflow.com/questions/52304422/property-values-does-not-exist-on-type-objectconstructor) – jedmao May 05 '20 at 20:02
  • 1
    Interesting. I am targeting es2018 so yes that could be the issue. –  May 05 '20 at 20:21

0 Answers0