Skip to content

fix(core): export missing shared types to prevent TS2742 in consumer projects#2586

Open
YKDZ wants to merge 1 commit intounovue:v2from
YKDZ:fix/export-missing-shared-types
Open

fix(core): export missing shared types to prevent TS2742 in consumer projects#2586
YKDZ wants to merge 1 commit intounovue:v2from
YKDZ:fix/export-missing-shared-types

Conversation

@YKDZ
Copy link
Copy Markdown

@YKDZ YKDZ commented Apr 8, 2026

🔗 Linked issue

N/A (new report)

❓ 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

Several shared types (DataOrientation, Direction, StringOrNumber, FormFieldProps, ScrollBodyOption, SingleOrMultipleProps, SingleOrMultipleType) are used in public component prop interfaces (e.g. SeparatorProps, TabsRootProps, AccordionRootProps, SliderRootProps, etc.) but are not re-exported from the main src/index.ts entry point.

During bundling, tsdown's advancedChunks places these types in an auto-generated internal chunk (e.g. index3.d.ts), which is not listed in the package's exports map. This causes TS2742 errors in consumer projects that use vue-tsc with declaration: true:

error TS2742: The inferred type of '__VLS_export' cannot be named without a reference to
'reka-ui/dist/index3'. This is likely not portable. A type annotation is necessary.

Affected components include (but are not limited to): Separator, Tabs, Accordion, Slider, RadioGroup, ToggleGroup, Toolbar, Stepper, ColorSlider, Listbox, and all other components whose props reference DataOrientation, Direction, or StringOrNumber.

Fix: Re-export the missing types from src/index.ts so they become part of the main index.d.ts declaration file, making them resolvable without referencing internal chunks.

Reproduction

  1. Create a Vue 3 project with declaration: true in tsconfig.json
  2. Install reka-ui@2.9.5
  3. Create a component wrapper for <Separator> or <TabsRoot> using defineProps<SeparatorProps>()
  4. Run vue-tsc --noEmit → TS2742 error

📝 Checklist

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

Summary by CodeRabbit

  • New Features
    • Expanded public type exports to provide additional type definitions for better type safety and improved developer experience when using the library.

…projects

Types like `DataOrientation`, `Direction`, `StringOrNumber`, etc. are used
in public component prop interfaces (e.g. `SeparatorProps`, `TabsRootProps`)
but were not re-exported from the main `index.ts` entry point. The bundler's
chunk splitting placed them in an internal chunk (`index3`), which is not
listed in the package `exports` map. This caused TS2742 errors in consumer
projects using `vue-tsc` with `declaration: true`:

  error TS2742: The inferred type of '__VLS_export' cannot be named without
  a reference to 'reka-ui/dist/index3'. This is likely not portable.

Re-exporting these types from `src/index.ts` ensures they are included in
the main `index.d.ts` declaration file, making them resolvable without
referencing internal chunks.
Copilot AI review requested due to automatic review settings April 8, 2026 02:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 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: 6bd93c5b-28d4-428b-9d89-1a8da64da151

📥 Commits

Reviewing files that changed from the base of the PR and between e655d29 and 90d29a3.

📒 Files selected for processing (1)
  • packages/core/src/index.ts

📝 Walkthrough

Walkthrough

The package's public type surface is expanded by re-exporting seven additional type definitions (DataOrientation, Direction, FormFieldProps, ScrollBodyOption, SingleOrMultipleProps, SingleOrMultipleType, StringOrNumber) from the shared types module in the main index file.

Changes

Cohort / File(s) Summary
Type Exports
packages/core/src/index.ts
Added seven new type re-exports from ./shared/types to expand the public API surface: DataOrientation, Direction, FormFieldProps, ScrollBodyOption, SingleOrMultipleProps, SingleOrMultipleType, StringOrNumber.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 With paws that type and whiskers that compile,
I've broadened what our core shall now beguile!
Seven types now dance in public view,
From shared semantics, fresh and true. ✨

🚥 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 accurately and concisely describes the main fix: exporting missing shared types to resolve TS2742 errors in consumer projects.
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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes downstream TypeScript declaration portability issues (TS2742) by ensuring commonly used shared types referenced by public component prop interfaces are exported from the package’s main entrypoint (packages/core/src/index.ts), preventing consumers from needing to reference tsdown-generated internal declaration chunks.

Changes:

  • Re-export shared public-facing types (DataOrientation, Direction, StringOrNumber, etc.) from packages/core/src/index.ts.
  • Ensure these types become part of the main declaration surface rather than ending up in internal, non-exported dist/index*.d.ts chunks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@2586

commit: 90d29a3

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