Registry
Aalexbit-codemod avatar

valibot_migrate_to_v0_31_0

Migrate your app to Valibot v0.31.0

alexbit-codemod14 executions

  • breaking-change
  • upgrade
  • valibot
Connect a repo
npx codemod valibot_migrate_to_v0_31_0

This codemod automatically migrates your Valibot codebase to version 0.31.0, handling all breaking changes introduced in this release.

What it migrates

  • Schema renames: custom → check, Input → InferInput, Output → InferOutput
  • Object merging: merge → object
  • Objects/tuples with rest: Transforms objectWithRest and tupleWithRest to new syntax
  • Loose/strict variants: Converts looseObject/strictObject and looseTuple/strictTuple to new API
  • Pipeline API: Migrates array-based pipelines to pipe() function calls
  • Method transformations: Updates coerce, flatten, brand, and transform method calls
  • Nested pipes: Flattens deeply nested schema compositions into cleaner pipe() chains

Example

Before (v0.30):

typescript
const schema = v.brand(
  v.transform(
    v.string([v.trim()]),
    (s) => s.toLowerCase()
  ),
  'ProcessedString'
);

After (v0.31):

typescript
const schema = pipe(
  string(),
  transform((s) => s.trim()),
  transform((s) => s.toLowerCase()),
  brand('ProcessedString')
);

License

MIT

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.