prompts
prompts copied to clipboard
confirm element: pressing a function key throws an error
Describe the bug
Using the confirm element, pressing one of the function keys (F1/F2...) throws an error.
To Reproduce
Steps to reproduce the behavior:
- Use the confirm element:
prompts({
type: 'confirm',
message: 'x',
});
- Press F2
Expected behavior
No error should be thrown
System
- OS: MacOS 12.5.1
- Terminal: iTerm
- Node version: 18.16.0
Additional context
Full stack trace:
node:internal/readline/emitKeypressEvents:71
throw err;
^
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at ConfirmPrompt._ (/node_modules/prompts/lib/elements/confirm.js:60:11)
at ReadStream.keypress (/node_modules/prompts/lib/elements/prompt.js:30:24)
at ReadStream.emit (node:events:513:28)
at emitKeys (node:internal/readline/utils:357:14)
at emitKeys.next (<anonymous>)
at ReadStream.onData (node:internal/readline/emitKeypressEvents:61:36)
at ReadStream.emit (node:events:525:35)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at ReadStream.Readable.push (node:internal/streams/readable:228:10)