SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.09k stars 1.3k forks source link

Fix(inquirer): Allow string choices (backward compat with v9 & prior) #1530

Closed SBoudrias closed 4 weeks ago

SBoudrias commented 1 month ago

Ref #1527

Inquirer v9 & prior allowed choices to be array of strings. Given how widespread that pattern is, we should maintain this backward compatibility. It'll also simplify the work of folks migrating from inquirer to @inquirer/prompts with less code change.

TODO

mshima commented 1 month ago

I saw later that there is backward compatibility in place: https://github.com/SBoudrias/Inquirer.js/blob/ce5d3b6ab903b43581c34f8069a6b4f108002eb1/packages/inquirer/src/ui/prompt.mts#L297-L306.

It's possible to add to backward compatibility types only: https://github.com/SBoudrias/Inquirer.js/blob/9b77c6777922cd8fd0a5c1711cf1cef19031c74b/packages/inquirer/src/types.mts#L50-L57

Of course if the string support is added to choices, the backward compatibility can be dropped.

SBoudrias commented 4 weeks ago

Ohh I forgot about that. I'll still bring it over to @inquirer/* since it makes migration easier.