Skip to content

fix!: resolve SelectItem barrel export collision in favor of the component#395

Merged
web-padawan merged 1 commit into
mainfrom
fix/select-item-data
Jul 24, 2026
Merged

fix!: resolve SelectItem barrel export collision in favor of the component#395
web-padawan merged 1 commit into
mainfrom
fix/select-item-data

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Problem

Since #390 added the SelectItem React component, the package barrel exports the name SelectItem twice via export * chains:

TypeScript resolves the duplicated name to the first star export, so SelectItem in type position now fails in consumer projects:

error TS2749: 'SelectItem' refers to a value, but is being used as a type here.

Resolution was also order-dependent (barrel line order follows schema-discovery order), so a reordering could have silently broken the component import instead. The repo's own validate:types never catches this because the barrel is emitted directly as index.d.ts/index.js and never compiled as source.

Change

  • The generated barrel now emits an explicit export { X } from './X.js'; per component after the star exports. Explicit exports beat star exports per-name, so each component name deterministically resolves to the component, independent of barrel order.
  • Added a type-level regression fixture (test/typings/SelectItem.tsx, compiled by validate:types) asserting: SelectItem works as a JSX component from the barrel, SelectItemData works in type position, SelectItem in type position is an error, and the deprecated type remains importable from @vaadin/react-components/Select.js.

SelectItemData was already re-exported transitively and keeps working unchanged; docs examples were migrated in vaadin/docs#5831. Runtime is unaffected — the collision was type-only.

BREAKING CHANGE

The deprecated TypeScript type SelectItem is no longer exported from the package barrel; use SelectItemData instead, or import the deprecated type from @vaadin/react-components/Select.js. SelectItem now refers to the React component. (In practice this break already shipped with 25.3.0-alpha6, where the component shadowed the type — this change makes the resolution deterministic and documented.)

🤖 Generated with Claude Code

…onent

The barrel exported the name SelectItem twice via star exports: the new
SelectItem React component and the deprecated SelectItem type re-exported
from @vaadin/select (deprecated in favor of SelectItemData in
vaadin/web-components#12132). TypeScript resolved the duplicate to the
first star export, breaking `SelectItem` in type positions (TS2749) and
leaving resolution dependent on barrel line order.

The generated barrel now emits explicit component re-exports after the
star exports, so each component name deterministically resolves to the
component.

Adds a tsc-based regression fixture (test/typings/SelectItem.tsx) that
compiles against the built @vaadin/react-components barrel and would
have caught this: SelectItem in value/JSX position, SelectItemData in
type position, and a @ts-expect-error asserting the deprecated type is
no longer importable from the barrel root.

BREAKING CHANGE: the deprecated TypeScript type SelectItem is no longer
exported from the package barrel; use SelectItemData instead, or import
the deprecated type from @vaadin/react-components/Select.js.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@web-padawan
web-padawan force-pushed the fix/select-item-data branch from f5959d9 to 1e7381e Compare July 24, 2026 09:53
@web-padawan
web-padawan merged commit e66ac17 into main Jul 24, 2026
2 of 3 checks passed
@web-padawan
web-padawan deleted the fix/select-item-data branch July 24, 2026 10:02
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