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
When the type is number, the validate function doesn't receive the initial value.
So if you have a number that requires validation, the user can't accept the default.
To Reproduce
Steps to reproduce the behavior:
Create a number prompt with an initial value
Run and accept the default value
Check the value in the validate function to see it's an empty string
importpromptsfrom"prompts";awaitprompts({type: "number",name: "value",message: "Enter a number",initial: 20,validate: (val)=>{// Value will be an empty string if you accepted the defaultconsole.log("value",val);returnval>0;},});
Expected behavior
The validate function would get the initial value and it would be a number.
System
Node version: 18.16
The text was updated successfully, but these errors were encountered:
Describe the bug
When the
type
is number, thevalidate
function doesn't receive theinitial
value.So if you have a number that requires validation, the user can't accept the default.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The validate function would get the initial value and it would be a number.
System
18.16
The text was updated successfully, but these errors were encountered: