Summary
path() relies on typed boolean options such as mustExist, mustNotExist, and allowCreate, but it does not validate them at runtime. If malformed truthy values like "no" reach the parser through an untyped path, JavaScript truthiness silently changes validation behavior.
Reproduction
import { path } from "@optique/run";
console.log(path({ mustExist: "no" as never }).parse("/tmp"));
console.log(path({ mustNotExist: "no" as never }).parse("/tmp"));
console.log(path({ allowCreate: "no" as never }).parse("nonexistent/file.txt"));
Current behavior:
mustExist: "no" still behaves like mustExist: true
mustNotExist: "no" still behaves like mustNotExist: true
allowCreate: "no" still enables parent-directory validation as if allowCreate were true
Expected behavior
Invalid runtime option types should be rejected up front instead of being silently coerced by JavaScript truthiness.
Actual behavior
The parser accepts malformed runtime values and quietly changes behavior.
Notes
This is a configuration-validation bug in the same family as the runtime option coercion issues already visible in hostname(), domain(), float(), and the IP parsers.
Summary
path()relies on typed boolean options such asmustExist,mustNotExist, andallowCreate, but it does not validate them at runtime. If malformed truthy values like"no"reach the parser through an untyped path, JavaScript truthiness silently changes validation behavior.Reproduction
Current behavior:
mustExist: "no"still behaves likemustExist: truemustNotExist: "no"still behaves likemustNotExist: trueallowCreate: "no"still enables parent-directory validation as ifallowCreatewere trueExpected behavior
Invalid runtime option types should be rejected up front instead of being silently coerced by JavaScript truthiness.
Actual behavior
The parser accepts malformed runtime values and quietly changes behavior.
Notes
This is a configuration-validation bug in the same family as the runtime option coercion issues already visible in
hostname(),domain(),float(), and the IP parsers.