Repository navigation
Conversation
Group the bound comparison before the explanatory error fallback so exclusive bounds preserve their intended diagnostic messages. AI assistance: OpenAI Codex.
FanWu-ai
marked this pull request as ready for review
October 11, 2026 22:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exclusive
minandmaxrefinements currently lose their explanatory error messages because|| messagebinds only to the false branch of the conditional expression. For example,validate(11, max(number(), 10, {exclusive: true}))returns a generic refinement error without the bound.Group the comparison expression before its error-message fallback. Acceptance, coercion, type signatures and dependencies are unchanged. Twelve regressions/controls cover numbers, dates, exact boundaries, inclusive messages and nested custom-error causes; six fail on the original source.
Validation
On Node 24.19.0 and 22.19.0, pristine full suite 225 passes; final 237 passes. Required
npm test(build and source/test types included),npm run lint(configured ESLint and whole-project Prettier), package build and diff checks pass. Additional 1,572 scenarios per runtime and 624 independent review cases pass.Two environment/check qualifications:
expect29.7 compatibility resolution for wildcard@types/expect; this patch makes no dependency change. A fresh unpinned CI install may differ.no-shadowfindings elsewhere inrefinements.ts. Pristine and final findings are identical at the same locations; the new test has none. That supplemental check is not claimed passed.Other CI runtimes and hosted results are not claimed. Prepared and tested with AI assistance (OpenAI Codex); no human review is claimed.