Conversation
Contributor
JonSilver
commented
Nov 17, 2025
- 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
Contributor
There was a problem hiding this comment.
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.