Migrating to Valchecker 1.0
0.0.33 establishes the intended 1.0 compatibility contract, ahead of the 1.0 version itself. Applications upgrading from earlier releases should review every item below.
Required migration review
- Runtime support is Node.js 22 or newer.
- Published packages are ESM-only; CommonJS uses dynamic
import(). - Built-in validations now use
isXxxnames, concrete transformations usetoXxx, and genericcheck()andtransform()retain their names. - Numeric
min()andmax()becomeisAtLeast()andisAtMost(); length bounds becomeisLengthAtLeast()andisLengthAtMost(). empty(),integer(),startsWith(), andendsWith()becomeisEmpty(),isInteger(),isStartingWith(), andisEndingWith().parseJSON(),stringifyJSON(), andtoSplitted()becometoJSONValue(),toJSONString(), andtoSplit().number()now matches TypeScriptnumber, includingNaNand positive or negative infinity. AddisFinite()where required.looseNumber()now normalizes TypeScript-compatible number strings;looseBoolean()andlooseBigint()apply the same model.- Message maps and snapshots must use renamed issue codes and explicit payload fields: numeric bounds use
minimum/maximum, while length bounds useminimumLength/maximumLength. isIncluding()reports its searched value under a singleexpectedpayload key for the string, array, and Set variants (the string variant previously usedsearch).execute()preserves sync or maybe-async behavior; use.toAsync()for an unconditional promise.- Callback steps support
PromiseLikevalues. union()returns the first successful branch's transformed output.intersection()uses graph-aware plain-object composition and rejects incompatible distinct non-plain instances.- Object validators read declared own properties only.
strictObject()includes unknown enumerable symbol keys.looseObject()preserves unknown own properties and is not an alias forobject().- Issue-path prepending does not mutate child issues.
- Plugin methods cannot collide with core names or use
thenor symbol names. - Accidental implementation helpers have been removed from public exports.
- Callback exceptions now use step-specific
operationissues instead of validation or generic core issues. check<AddedIssue>()preserves domain issue typing fromaddIssue().- JSON serialization, length validation, and mapped-boolean payloads expose additional diagnostic fields.
literal()usesObject.is;toBigint:invalid_bigintbecomestoBigint:conversion_failed.toNumber:conversion_failedandtoBigint:conversion_failedare nowoperationissues rather thanvalidation, because a throwing native conversion is an operation failure.toJSONString()fails on sparse array holes withtoJSONString:unserializable({ reason: 'undefined_result' }) instead of serializing them tonull.toString()takes a trailing options object{ radix?, message? };toString(16)becomestoString({ radix: 16 }).
Common rename example
Before:
ts
v.string()
.min(3)
.max(20)
.startsWith('user_')After:
ts
v.string()
.isLengthAtLeast(3)
.isLengthAtMost(20)
.isStartingWith('user_')Finite numeric validation should now be explicit:
ts
v.number()
.isFinite()
.isInteger()
.isAtLeast(0)The complete migration procedure, issue-code mapping, examples, removed-export list, and verification checklist are maintained in the repository's MIGRATION.md.
For normative behavior after migration, read the Valchecker 1.0 Contract.
Reporting a problem
Report a problem with:
- exact Valchecker version,
- Node.js and TypeScript versions,
- module resolution mode,
- minimal schema and input,
- actual and expected result,
- whether execution used
execute()or~standard.
Fixes are published under new versions; existing npm versions are never overwritten.