Thanks to visit codestin.com
Credit goes to github.com

Skip to content

build(types): add ESNext to tsconfig's lib#1297

Open
8ctavio wants to merge 2 commits intoh3js:mainfrom
8ctavio:refactor/tsconfig
Open

build(types): add ESNext to tsconfig's lib#1297
8ctavio wants to merge 2 commits intoh3js:mainfrom
8ctavio:refactor/tsconfig

Conversation

@8ctavio
Copy link
Contributor

@8ctavio 8ctavio commented Feb 6, 2026

Resolves #1291.

  • Adds "ESNext" to tsconfig's lib option (included in lib's default value for target: "ESNext").
  • Adds override to HTTPError methods and properties.
  • Removes @ts-expect-error comments when creating Errors with cause.

Summary by CodeRabbit

  • Refactor
    • Enhanced TypeScript type safety with stricter override semantics for class members and methods.
    • Expanded TypeScript library feature set to improve compatibility and type definitions.
    • Removed unnecessary type-checking directives for cleaner code.

@8ctavio 8ctavio requested a review from pi0 as a code owner February 6, 2026 15:33
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

This PR adds "ESNext" to the tsconfig.json lib array to enable native Error.cause support, then marks the HTTPError class's cause property and static isError method as overrides to properly reflect their inheritance, removes a now-unnecessary @ts-expect-error directive, and applies a minor formatting fix.

Changes

Cohort / File(s) Summary
TypeScript Configuration
tsconfig.json
Extended lib array to include "ESNext" alongside existing WebWorker, DOM, and DOM.Iterable entries, enabling modern error handling features.
Error Handling
src/error.ts, test/errors.test.ts
Marked cause property and static isError method in HTTPError (and corresponding test CustomError class) with override modifier to properly indicate they override base class members.
Type Checking Cleanup
src/utils/base.ts
Removed @ts-expect-error compiler directive preceding the Error throw statement, now valid with ESNext lib included.
Formatting
src/handler.ts
Removed space in parameter list formatting of resolveLazyHandler within defineLazyEventHandler Promise chain.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 The lib expands with ESNext grace,
Errors now carry cause in place,
Override marks what's long been true,
No more suppression, clean and new!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change in the PR, which adds ESNext to tsconfig's lib array. This is the primary objective from the linked issue.
Linked Issues check ✅ Passed All coding requirements from issue #1291 are met: ESNext added to tsconfig lib [#1291], @ts-expect-error removed from Error creation [#1291], and override markers added to HTTPError members [#1291].
Out of Scope Changes check ✅ Passed The PR includes a minor formatting change (space removal in handler.ts) and test file updates that are directly related to the core objectives, with no unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 6, 2026

Open in StackBlitz

npm i https://pkg.pr.new/h3js/h3@1297

commit: 4aaec99

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.

Add esnext to tsconfig.json's lib option

1 participant