Inquirer.js
Inquirer.js copied to clipboard
checkbox type doesn't accept 'loop' option with Typescript
Hello!
I'm using Inquirer to let user select one or more choices from a list. Therefore I'm using 'checkbox' type but typescript generates an error:
Type '"checkbox"' is not assignable to type '"number"'.ts(2322)
// doesn't compile
const myQuestion: inquirer.QuestionCollection = {
type: 'checkbox',
message: 'make your selection',
name: 'selection',
choices: ['Choice1', 'Choice2', 'Choice3'],
loop: false
}
It seems to only be a type error since replacing the type by any works as expected and doesn't create the type error
// compiles & works (but no typing anymore)
const myQuestion: any = {
type: 'checkbox',
message: 'make your selection',
name: 'selection',
choices: ['Choice1', 'Choice2', 'Choice3'],
loop: false
}