-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add error generic type parameter and upgrade dependencies #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JonSilver
merged 10 commits into
master
from
claude/enhance-error-typing-deps-01WAiiX9K3QCqbNtXv2xxziS
Feb 10, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7e32c0b
feat: add error generic type parameter and upgrade dependencies
claude ae90b04
docs: add TypeScript error generic documentation to README
claude 6230d74
build: add package metadata for better bundler optimization
claude e0fccff
docs: add CHANGELOG for version tracking
claude a2af610
ci: add GitHub Actions workflows for CI/CD
claude e91a3ea
test: add tests for custom error generic type parameter
JonSilver f1479f1
ci: add release script and fix test command for CI
JonSilver 51e7980
Update CHANGELOG.md
JonSilver ff3c254
Update .github/workflows/ci.yml
JonSilver b3e8db6
Update package.json
JonSilver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test on Node.js ${{ matrix.node-version }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| node-version: [20.x, 22.x] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --legacy-peer-deps | ||
|
|
||
| - name: Run linter | ||
| run: npm run lint:scripts | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
|
|
||
| - name: Build | ||
| run: npm run build | ||
|
|
||
| - name: Upload coverage | ||
| if: matrix.node-version == '20.x' | ||
| uses: codecov/codecov-action@v4 | ||
| continue-on-error: true | ||
| with: | ||
| fail_ci_if_error: false |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Publish to npm | ||
|
|
||
| on: | ||
| release: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.x' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --legacy-peer-deps | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
|
|
||
| - name: Build | ||
| run: npm run build | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish --access public --provenance | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [1.4.0] - 2025-11-15 | ||
|
|
||
| ### Added | ||
| - **Generic error type parameter**: You can now specify custom error types for both `attempt` and `attemptPromise` | ||
| - Both functions now accept two type parameters: `<T, E = Error>` | ||
| - The error type defaults to `Error` for backward compatibility | ||
| - Example: `attempt<User, ValidationError>(() => ...)` | ||
| - Package metadata: | ||
| - `sideEffects: false` for better tree-shaking support | ||
| - `engines` field specifying Node.js ^20.19.0 || >=22.12.0 | ||
|
|
||
| ### Changed | ||
| - **Major dependency upgrades**: | ||
| - ESLint: 8.54.0 → 9.39.1 (migrated to flat config format) | ||
| - TypeScript: 5.3.2 → 5.9.3 | ||
| - Vite: 5.0.2 → 7.2.2 | ||
| - Vitest: 0.34.6 → 4.0.9 | ||
| - Prettier: 2.8.8 → 3.6.2 | ||
| - All other dev dependencies updated to latest versions | ||
| - Build tooling: | ||
| - Migrated ESLint configuration from `.eslintrc.json` to `eslint.config.js` (flat config) | ||
| - Updated package.json exports order (types before import/require) | ||
| - Replaced deprecated `@vitest/coverage-c8` with `@vitest/coverage-v8` | ||
|
|
||
| ### Fixed | ||
| - Package.json exports now list types first for better IDE support | ||
|
|
||
| ## [1.3.9] - Previous release | ||
|
|
||
| ### Changed | ||
| - Type export improvements | ||
| - CJS package fixes | ||
|
|
||
| ## [1.2.x] - Previous releases | ||
|
|
||
| ### Removed | ||
| - `attemptAllPromise` function (caused confusion, may be replaced with better implementation in future) |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import globals from "globals"; | ||
| import js from "@eslint/js"; | ||
| import tseslint from "@typescript-eslint/eslint-plugin"; | ||
| import tsparser from "@typescript-eslint/parser"; | ||
| import prettierConfig from "eslint-config-prettier"; | ||
| import prettierPlugin from "eslint-plugin-prettier"; | ||
|
|
||
| export default [ | ||
| js.configs.recommended, | ||
| { | ||
| files: ["**/*.ts", "**/*.js"], | ||
| languageOptions: { | ||
| ecmaVersion: 2020, | ||
| sourceType: "module", | ||
| globals: { | ||
| ...globals.node, | ||
| ...globals.es6, | ||
| Atomics: "readonly", | ||
| SharedArrayBuffer: "readonly" | ||
| }, | ||
| parser: tsparser, | ||
| parserOptions: { | ||
| ecmaVersion: 2020 | ||
| } | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": tseslint, | ||
| prettier: prettierPlugin | ||
| }, | ||
| rules: { | ||
| "prettier/prettier": [ | ||
| "warn", | ||
| { | ||
| endOfLine: "auto" | ||
| } | ||
| ], | ||
| "no-unused-vars": "off", | ||
| "@typescript-eslint/no-unused-vars": "warn", | ||
| "no-console": "off", | ||
| "no-extra-semi": "warn", | ||
| "no-extra-boolean-cast": "warn", | ||
| "no-undef": "off" // TypeScript handles this | ||
| } | ||
| }, | ||
| prettierConfig | ||
| ]; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.