refactor: unify AddResult and RemovalResult into Result<T>#1088
refactor: unify AddResult and RemovalResult into Result<T>#1088Hweinstock wants to merge 1 commit intoaws:mainfrom
Conversation
|
Thanks for the refactor — the shape of 1. Catch blocks discard the original
|
a2eccff to
530a76e
Compare
530a76e to
4c58c70
Compare
4c58c70 to
6255734
Compare
|
addressed missed migrations, and avoided rewrapping error. |
6255734 to
7a6c9df
Compare
7a6c9df to
e2bafea
Compare
e2bafea to
0ba5c9c
Compare
0ba5c9c to
b47e7fc
Compare
- Introduce Result<T> discriminated union with data field (Rust-inspired) - Error fields now carry Error objects instead of raw strings - AddResult<T> and RemovalResult preserved as deprecated aliases - data is required on success branch when T is not void - No data field when T is void (removals) 44 files changed, all tests passing (3901 tests)
b47e7fc to
d4898a7
Compare
Description
Introduces a unified
Result<T>discriminated union type that replaces bothAddResult<T>andRemovalResult, inspired by Rust'sResult<T, E>.Key changes:
Errorobjects instead of raw strings — enables stack traces, cause chains, andinstanceofnarrowingdatafield wraps success payload instead of intersection spread — no more field name collisionsdatais required on the success branch whenTis not void (compiler-enforced), absent whenTis void (removals)AddResult<T>andRemovalResultlabeled as proxies to shared Result shape.Why
Related Issue
Closes #
Documentation PR
N/A — internal type refactor, no user-facing changes.
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.