Skip to content

fix(defu.d.cts): export Defu types#157

Merged
pi0 merged 3 commits intounjs:mainfrom
J-Michalek:patch-1
Apr 7, 2026
Merged

fix(defu.d.cts): export Defu types#157
pi0 merged 3 commits intounjs:mainfrom
J-Michalek:patch-1

Conversation

@J-Michalek
Copy link
Copy Markdown
Contributor

@J-Michalek J-Michalek commented Apr 3, 2026

407b516#r181346453

Summary by CodeRabbit

  • New Features

    • Enhanced TypeScript support with improved generic type inference for merged results.
  • Refactor

    • Reorganized exported namespace members for better API clarity and type declaration structure.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 619ad6d7-3d18-4aed-90e6-6f0b00bfb356

📥 Commits

Reviewing files that changed from the base of the PR and between 17114f9 and b840777.

📒 Files selected for processing (1)
  • lib/defu.d.cts
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/defu.d.cts

📝 Walkthrough

Walkthrough

The TypeScript declaration lib/defu.d.cts changes the exported defuProxy from a constant intersection type to a generic function signature and moves previously-attached members into a declare namespace defuProxy with explicit runtime exports and a type re-export list.

Changes

Cohort / File(s) Summary
Declaration change
lib/defu.d.cts
Replaced declare const defuProxy: DefuInstance & { ... } with a generic function declaration `declare function defuProxy<Source extends _Input, Defaults extends Array<_Input

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐇 I hopped through types and changed my course,
From const to generic with gentle force,
Namespace friends now sit in view,
Defu, DefuFn — hello anew,
A tiny hop for simpler imports, of course.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(defu.d.cts): export Defu types' accurately describes the main change: converting defuProxy to a generic function and restructuring namespace members to properly export Defu types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/defu.d.cts`:
- Around line 13-14: Remove the top-level `export type { Defu, DefuFn,
DefuInstance }` and replace it by declaring a namespace named `defuProxy` that
re-exports the types (`Defu`, `DefuFn`, `DefuInstance`) inside it, then use
`export = defuProxy` as the module export; locate the current `export type`
statement and the `defuProxy`/`defu` declarations and move the type definitions
into `declare namespace defuProxy { export type Defu = ...; export type DefuFn =
...; export type DefuInstance = ... }` so the module uses the
CommonJS-compatible `export = defuProxy` mechanism.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7cde49bd-828b-45e9-b2b4-c90a1cec5a3d

📥 Commits

Reviewing files that changed from the base of the PR and between 001c290 and 17114f9.

📒 Files selected for processing (1)
  • lib/defu.d.cts

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (70cffe5) to head (b840777).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##             main      #157       +/-   ##
============================================
+ Coverage   45.73%   100.00%   +54.26%     
============================================
  Files           4         2        -2     
  Lines         223        46      -177     
  Branches       35        18       -17     
============================================
- Hits          102        46       -56     
+ Misses        119         0      -119     
+ Partials        2         0        -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pi0 pi0 merged commit 40d7ef4 into unjs:main Apr 7, 2026
4 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.

2 participants