Skip to content

fix: avoid TS2698 in generated Drawer.vue for Nuxt 4#1787

Open
galoi wants to merge 1 commit intounovue:devfrom
galoi:fix/#1785-drawer-ts2698-nuxt4
Open

fix: avoid TS2698 in generated Drawer.vue for Nuxt 4#1787
galoi wants to merge 1 commit intounovue:devfrom
galoi:fix/#1785-drawer-ts2698-nuxt4

Conversation

@galoi
Copy link
Copy Markdown

@galoi galoi commented Apr 21, 2026

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

  • Restore the ComputedRef<Record<string, unknown>> cast on useForwardPropsEmits(props, emits) in the generated Drawer.vue template.
  • Apply the same fix to every v4 style output and the published registry JSON so CLI consumers receive the corrected template.
  • This keeps v-bind="forwarded" typed as an object in Nuxt 4 consumers and avoids the reported TS2698 error.

📸 Screenshots (if appropriate)

  • None.

確認項目

  • pnpm test
  • pnpm lint

その他

  • pnpm --filter v4 typecheck still fails on unrelated existing errors in files such as components/content/Tabs*.vue, registry/bases/reka/examples/pagination/*.vue, and */ui/sonner/Sonner.vue.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Summary by CodeRabbit

  • Refactor
    • Improved TypeScript type safety across drawer components in multiple style variants by adding explicit type annotations. No runtime behavior or user-facing functionality was altered.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

📝 Walkthrough

Walkthrough

Multiple Drawer.vue component files across various UI style packages now explicitly import the ComputedRef type from Vue and cast the forwarded value returned by useForwardPropsEmits(props, emits) to ComputedRef<Record<string, unknown>>, improving TypeScript type inference without altering runtime behavior.

Changes

Cohort / File(s) Summary
Public Registry Style Drawers
apps/v4/public/r/styles/new-york-v4/drawer.json, apps/v4/public/r/styles/reka-luma/drawer.json, apps/v4/public/r/styles/reka-lyra/drawer.json, apps/v4/public/r/styles/reka-maia/drawer.json, apps/v4/public/r/styles/reka-mira/drawer.json, apps/v4/public/r/styles/reka-nova/drawer.json, apps/v4/public/r/styles/reka-vega/drawer.json
Added ComputedRef type import and explicitly cast forwarded to ComputedRef<Record<string, unknown>> for improved TypeScript type safety.
Registry Base Drawer
apps/v4/registry/bases/reka/ui/drawer/Drawer.vue
Added ComputedRef type import and type-cast forwarded from useForwardPropsEmits(props, emits) to ComputedRef<Record<string, unknown>>.
Registry Style-Specific Drawers
apps/v4/registry/new-york-v4/ui/drawer/Drawer.vue
Added ComputedRef type import and explicit type assertion for forwarded value to improve type inference.
Styles Directory Drawers
apps/v4/styles/reka-luma/ui/drawer/Drawer.vue, apps/v4/styles/reka-lyra/ui/drawer/Drawer.vue, apps/v4/styles/reka-maia/ui/drawer/Drawer.vue, apps/v4/styles/reka-mira/ui/drawer/Drawer.vue, apps/v4/styles/reka-nova/ui/drawer/Drawer.vue, apps/v4/styles/reka-vega/ui/drawer/Drawer.vue
Added ComputedRef type import and cast forwarded to ComputedRef<Record<string, unknown>> across all style variants for consistent typing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • #1785: Addresses the same TypeScript type inference issue by casting forwarded from useForwardPropsEmits(props, emits) to ComputedRef<Record<string, unknown>> across multiple Drawer component files, matching the core fix for improved type safety.

Poem

🐰 A rabbit's refrain on types refined,
ComputedRef cast, now clear in mind,
Forwarded props dance with proper grace,
TypeScript smiles across each place! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing a TypeScript error (TS2698) in the generated Drawer.vue component for Nuxt 4 by restoring a type cast.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/v4/public/r/styles/reka-mira/drawer.json (1)

1-62: ⚠️ Potential issue | 🔴 Critical

Add the ComputedRef<Record<string, unknown>> cast to two missing registry JSONs.

The fix is incomplete. All Drawer.vue source files are properly covered, but two registry payloads are missing the cast:

  • apps/v4/public/r/styles/default/drawer.json
  • apps/v4/public/r/styles/new-york/drawer.json

These must also include the cast in their embedded Drawer.vue content to prevent TS2698 for CLI consumers using those style variants.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/v4/public/r/styles/reka-mira/drawer.json` around lines 1 - 62, In the
two missing registry JSONs, update the embedded Drawer.vue so the forwarded
variable is explicitly cast to ComputedRef<Record<string, unknown>> to avoid
TS2698: change the result of useForwardPropsEmits(props, emits) assigned to
forwarded to include the TypeScript cast (keep the existing props/emits,
useForwardPropsEmits symbol, and the forwarded identifier); ensure the
assignment mirrors the working file where forwarded is defined as const
forwarded = useForwardPropsEmits(props, emits) as ComputedRef<Record<string,
unknown>> in Drawer.vue.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/v4/public/r/styles/reka-mira/drawer.json`:
- Around line 1-62: In the two missing registry JSONs, update the embedded
Drawer.vue so the forwarded variable is explicitly cast to
ComputedRef<Record<string, unknown>> to avoid TS2698: change the result of
useForwardPropsEmits(props, emits) assigned to forwarded to include the
TypeScript cast (keep the existing props/emits, useForwardPropsEmits symbol, and
the forwarded identifier); ensure the assignment mirrors the working file where
forwarded is defined as const forwarded = useForwardPropsEmits(props, emits) as
ComputedRef<Record<string, unknown>> in Drawer.vue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f47a884-dff7-45f5-acec-f0c64b03e501

📥 Commits

Reviewing files that changed from the base of the PR and between 5a94ad2 and eb5173d.

📒 Files selected for processing (15)
  • apps/v4/public/r/styles/new-york-v4/drawer.json
  • apps/v4/public/r/styles/reka-luma/drawer.json
  • apps/v4/public/r/styles/reka-lyra/drawer.json
  • apps/v4/public/r/styles/reka-maia/drawer.json
  • apps/v4/public/r/styles/reka-mira/drawer.json
  • apps/v4/public/r/styles/reka-nova/drawer.json
  • apps/v4/public/r/styles/reka-vega/drawer.json
  • apps/v4/registry/bases/reka/ui/drawer/Drawer.vue
  • apps/v4/registry/new-york-v4/ui/drawer/Drawer.vue
  • apps/v4/styles/reka-luma/ui/drawer/Drawer.vue
  • apps/v4/styles/reka-lyra/ui/drawer/Drawer.vue
  • apps/v4/styles/reka-maia/ui/drawer/Drawer.vue
  • apps/v4/styles/reka-mira/ui/drawer/Drawer.vue
  • apps/v4/styles/reka-nova/ui/drawer/Drawer.vue
  • apps/v4/styles/reka-vega/ui/drawer/Drawer.vue

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.

[Bug]: Drawer.vue triggers TS2698 in Nuxt 4 consumers

1 participant