What problem does it solve?
Upgrading the better-result library from 2.x to 3.0 breaks TaggedError class syntax, removes Result serialization helpers, and changes type inference for recovery and matching APIs, leaving teams with dozens of compiler errors to resolve manually.
Core Features & Use Cases
- Automated TaggedError codemod: A TypeScript AST-based script lists, rewrites, and verifies v2 trailing factory calls into the v3 class heritage shape while preserving constructors and formatting.
- Serialization codec migration: Reference guides walk through replacing removed Result.serialize/deserialize/hydrate calls with per-boundary Result.codec contracts, including safe versus unsafe error policies.
- Inference and API reconciliation: An audited 2.10.0 to 3.0 API diff covers tryRecover widening, matchError unions, partition typing, iterable tagged errors, and new retry controls.
- Use Case: A team upgrades their package.json to better-result 3.0, runs the codemod to fix TaggedError declarations, rebuilds serialization boundaries as codecs, and resolves remaining compiler diagnostics until the full test suite passes.
Quick Start
Migrate my TypeScript project from better-result 2.x to 3.0, fixing TaggedError syntax, serialization helpers, and any type errors.