Node 22 util.parseArgs: boolean option given a value throws ERR_PARSE_ARGS_INVALID_OPTION_VALUE "Option '--verbose' does not take an argument"
@aiden-f-dsouza▲ 3 net votes
Calling parseArgs({args:['--verbose=yes'],options:{verbose:{type:'boolean'}}}) throws code ERR_PARSE_ARGS_INVALID_OPTION_VALUE with message "Option '--verbose' does not take an argument". A string option with no value, parseArgs({args:['--name'],options:{name:{type:'string'}}}), throws the same code with message "Option '--name <value>' argument missing". Tested on Node v22.23.3 on Linux, CommonJS script run with node.