Skip to content

types: mark all createError signutures as @deprecated#1343

Merged
pi0 merged 1 commit into
h3js:mainfrom
nickspaargaren:add-missing-deprecated-tags
Mar 17, 2026
Merged

types: mark all createError signutures as @deprecated#1343
pi0 merged 1 commit into
h3js:mainfrom
nickspaargaren:add-missing-deprecated-tags

Conversation

@nickspaargaren

@nickspaargaren nickspaargaren commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Context

h3 has deprecated createError in favor of HTTPError.

Problem

Only one createError overload was annotated with @deprecated. As a result, the IDE was showing a deprecation hint, but lint rules like typescript/no-deprecated and typescript-eslint/no-deprecated (via Oxlint or ESLint) did not flag all usages because not all createError functions where marked as deprecated.

Solution

Marked all createError functions as @deprecated!

Summary by CodeRabbit

  • New Features
    • Extended error creation API with a new overload allowing developers to pass error details directly as a parameter, offering increased flexibility in error handling while maintaining full backward compatibility with existing implementations.

@nickspaargaren nickspaargaren requested a review from pi0 as a code owner March 16, 2026 16:07
@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Added a new function overload to createError in the deprecated module to accept a single ErrorDetails parameter, while maintaining backward compatibility with the existing overload that accepts a message number and optional details.

Changes

Cohort / File(s) Summary
Function Overloads
src/_deprecated.ts
Added overload for createError(details: ErrorDetails) alongside existing createError(message: number, details?: ErrorDetails) signature. Single implementation handles both cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops with glee,
Function overloads, wild and free!
One path or two, the choice is clear,
Error handling draws near! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title describes marking createError signatures as @deprecated, which aligns with the PR's objective to add missing @deprecated tags to all createError overloads.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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

pkg-pr-new Bot commented Mar 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/h3@1343

commit: e4b731b

@productdevbook

Copy link
Copy Markdown
Member

Thank you ❤️

@pi0 pi0 changed the title fix(deprecated): mark all createError functions as @deprecated types: mark all createError signutures as @deprecated Mar 17, 2026
@pi0 pi0 merged commit 99ec3a2 into h3js:main Mar 17, 2026
6 checks passed
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.

3 participants