Skip to content

feat: add error generic type parameter and upgrade dependencies#3

Merged
JonSilver merged 10 commits intomasterfrom
claude/enhance-error-typing-deps-01WAiiX9K3QCqbNtXv2xxziS
Feb 10, 2026
Merged

feat: add error generic type parameter and upgrade dependencies#3
JonSilver merged 10 commits intomasterfrom
claude/enhance-error-typing-deps-01WAiiX9K3QCqbNtXv2xxziS

Conversation

@JonSilver
Copy link
Contributor

  • Add generic error type parameter (E = Error) to all attempt types and functions
  • Allows clients to type custom error types in addition to return values
  • Bump version from 1.3.9 to 1.4.0 (minor version bump)
  • Upgrade all dependencies to latest versions:
    • ESLint 8 → 9 (migrated to flat config)
    • TypeScript 5.3 → 5.9
    • Vite 5 → 7
    • Vitest 0.34 → 4.0
    • Prettier 2 → 3
    • All other dev dependencies to latest
  • Fix package.json exports order (types before import/require)
  • All tests passing with new type system

- Add generic error type parameter (E = Error) to all attempt types and functions
- Allows clients to type custom error types in addition to return values
- Bump version from 1.3.9 to 1.4.0 (minor version bump)
- Upgrade all dependencies to latest versions:
  - ESLint 8 → 9 (migrated to flat config)
  - TypeScript 5.3 → 5.9
  - Vite 5 → 7
  - Vitest 0.34 → 4.0
  - Prettier 2 → 3
  - All other dev dependencies to latest
- Fix package.json exports order (types before import/require)
- All tests passing with new type system
- Document new v1.4.0 feature for typing custom error types
- Add TypeScript usage examples for both sync and async
- Show custom error type patterns (ValidationError, ApiError)
- Clarify backward compatibility (defaults to Error type)
- Add sideEffects: false for better tree-shaking
- Add engines constraint (Node.js >= 18.0.0)
- Document v1.4.0 changes including error generic feature
- List all dependency upgrades and build tooling changes
- Follow Keep a Changelog format for consistency
- Add CI workflow for automated testing on PRs and pushes
  - Test on Node.js 18.x, 20.x, and 22.x
  - Run linting, tests, and build
  - Upload code coverage to Codecov
- Add publish workflow for automated npm releases
  - Triggers on GitHub releases
  - Publishes to npm with provenance
  - Requires NPM_TOKEN secret to be configured
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds generic error type parameters to the attempt library, enabling TypeScript users to specify custom error types in addition to result types. It also includes a major upgrade of all development dependencies to their latest versions, including ESLint 9 with flat config, TypeScript 5.9, Vite 7, and Vitest 4.

Key Changes:

  • Added generic error type parameter <T, E = Error> to all attempt types and functions with backward compatibility
  • Upgraded tooling dependencies: ESLint 8→9 (flat config), TypeScript 5.3→5.9, Vite 5→7, Vitest 0.34→4
  • Added comprehensive TypeScript usage documentation and examples in ReadMe.md

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/index.ts Added generic error type parameter E to all types and functions, enabling custom error type support
package.json Bumped version to 1.4.0, reordered exports (types first), added sideEffects and engines fields, upgraded all dependencies
eslint.config.js New flat config format for ESLint 9 migration
ReadMe.md Added comprehensive TypeScript documentation with examples for generic error types
CHANGELOG.md New changelog documenting v1.4.0 changes and upgrade details
.github/workflows/publish.yml New GitHub Actions workflow for automated npm publishing
.github/workflows/ci.yml New GitHub Actions workflow for continuous integration testing
.eslintrc.json Removed legacy ESLint configuration file (replaced by flat config)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

JonSilver and others added 5 commits February 10, 2026 12:09
Cover the error type generic (`E`) for both `attempt` and
`attemptPromise`, including runtime assertions and compile-time
type checking via `expectTypeOf`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add scripts/release.sh to automate version bump, git tag, push, and
GitHub release creation — triggering the existing publish workflow.

Fix `npm test` from `vitest` (watch mode) to `vitest run` so CI
pipelines don't hang.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JonSilver JonSilver merged commit 7a67e31 into master Feb 10, 2026
2 checks passed
@JonSilver JonSilver deleted the claude/enhance-error-typing-deps-01WAiiX9K3QCqbNtXv2xxziS branch February 10, 2026 12:25
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