Skip to content

WEBDEV-8508: Migrate result-type into elements#52

Open
jbuckner wants to merge 2 commits into
mainfrom
WEBDEV-8508-migrate-result-type
Open

WEBDEV-8508: Migrate result-type into elements#52
jbuckner wants to merge 2 commits into
mainfrom
WEBDEV-8508-migrate-result-type

Conversation

@jbuckner
Copy link
Copy Markdown
Collaborator

@jbuckner jbuckner commented May 27, 2026

Summary

Moves @internetarchive/result-type into src/types/result.ts per WEBDEV-8506 / #50. The smallest of the migration chain — one pure-TypeScript interface that metadata-service uses to wrap success/error responses.

Changes

  • src/types/result.ts — exact copy of the Result<T, E> interface.
  • src/types/result.test.ts — ported to vitest. The error-initialization test used a runtime enum FooErrorType, converted to a const … as const + type alias to satisfy erasableSyntaxOnly: true.

Verification

  • npm run build
  • npm run test ✓ — 213 tests pass (2 new)
  • npm run circular

Order in the migration chain

QA waived — types-only, no runtime artifact.

Test plan

  • Build green
  • Tests pass
  • Reviewer: confirm the const-object replacement for the enum reads cleanly inside the test (FooErrorType is test-internal; it doesn't affect the shipped Result type)

🤖 Generated with Claude Code

Moves @internetarchive/result-type into src/types/result.ts. Pure
TypeScript type — no runtime artifact. Test ported to vitest; the
FooErrorType enum used by the error test became a const object for
erasableSyntaxOnly compatibility.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-52/

Built to branch ghpages at 2026-05-28 20:59 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.75%. Comparing base (9a3b0f3) to head (f2ddb02).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #52   +/-   ##
=======================================
  Coverage   78.75%   78.75%           
=======================================
  Files          16       16           
  Lines         645      645           
  Branches      168      168           
=======================================
  Hits          508      508           
  Misses         95       95           
  Partials       42       42           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants